Re: [PHP] upload an image and store it in mysql

2004-07-16 Thread i sidhu
* iNder Sidhu wrotes:-
I use following query to upload the image in database
 
DATABASE_query_die(INSERT INTO images (`name`, `status`, `image`, `size`, `type`) 
VALUES (name.gif', NULL, 
0x52306c474f446c685a414179414f594141502f2f2f2f2f3238502f31372f54313976503, '1.624 kb', 
'image/gif'));
 
0x52306c474f446c685a414179414f594141502f2f2f2f2f3238502f31372f54313976503 - This is 
base64 code for ur image.
 
 
 
 
 
 

Curt Zirzow [EMAIL PROTECTED] wrote:
* Thus wrote raditha dissanayake:
 The approach that an overwhelming majority of PHP developers (and other 
 developers for that matter) use is to simply store the image on the 
 file system. If these images are part of a web application you can then 
 store a reference to the image in the database (ie: the filename only). 
 Then all you need to do is to query the database and use the result in 
 an  nothing could be simpler.

height and width are handy as well.



Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




-
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!

Re: [PHP] Re: displaying database results with forward and back buttons

2004-07-11 Thread i sidhu
The main part of code i m using for Forward and Backward is,
 
 
 
if($page  1)
{
$prev = ($page - 1);
echo a 
href=\.$_SERVER['PHP_SELF'].?page=$prevsearchfor=$searchforseek=$seekage1=$age1age2=$age2state=$statecountry=$country\
 TARGET=\_parent\Previous/anbsp;;
}
for($i = 1; $i = $total_pages; $i++)
{
if(($page) == $i)
{
echo $inbsp;;
} else
{
echo a 
href=\.$_SERVER['PHP_SELF'].?page=$isearchfor=$searchforseek=$seekage1=$age1age2=$age2state=$statecountry=$country\
 TARGET=\_parent\$i/anbsp;;
}
}
// Build Next Link
if($page  $total_pages)
{
$next = ($page + 1);
echo a 
href=\.$_SERVER['PHP_SELF'].?page=$nextsearchfor=$searchforseek=$seekage1=$age1age2=$age2state=$statecountry=$country\
 TARGET=\_parent\Next/a;
}

 
Change variables accroding to u.
 
 
 
John Taylor-Johnston [EMAIL PROTECTED] wrote:
Finally something I can give back, made by my little lonesome with no help :)

 I have a query that returns lots of rows so I want to display the results in blocks 
 of 25 or so on my web page and have forward and back buttons to navigate the results.

include it first:

include(settings_limit.inc);

then set $offset and $limit in your sql

$sql = 'SELECT *,MATCH (field1,field2)
AGAINST (\''.$searchenquiry.'\' IN BOOLEAN MODE)
AS relevancy FROM '.$table.'
WHERE MATCH (field1,field2)
AGAINST (\''.$searchenquiry.'\' IN BOOLEAN MODE)
ORDER BY relevancy DESC
LIMIT '.$offset.','.$limit.';';

--settings_limit.inc

#
## $mycounter is set by script calling settings_limit.inc 
#

#
### Set $offset  $limit 
#

if((!$offset) || ($offset  0))
{
$offset = 0;
}
$limit = 25;

#
### $nextinsert #
#
$new_offset = $offset + $limit;
$disp = $limit;
if ($new_offset + $limit  $mycounter)
{
$disp = $mycounter - $new_offset;
}
if ($disp  0)
{
$nextinsert = Next .$disp. Requests  [input] \ [input]  [input]  [input] ;
if($searchenquiry)
$nextinsert .=  [input] ;
if($scholarsenquiry)
$nextinsert .=  [input] ;
if($titlesenquiry)
$nextinsert .=  [input] ;
$nextinsert .= ;
}
#
### $previousinsert #
#

$new_offset2 = $offset - $limit;
if ($offset  0) // can display previous msg
{
$disp = $limit;
$previousinsert =   Previous .$disp. Requests;

$previousinsert =  [input]  Previous .$disp. Requests [input]  [input]  [input] ;
if($searchenquiry)
$previousinsert .=  [input] ;
if($scholarsenquiry)
$previousinsert .=  [input] ;
if($titlesenquiry)
$previousinsert .=  [input] ;
$previousinsert .= ;
}
#
### $lastinsert #
#

$new_offset3 = $mycounter - $limit;

if (($new_offset3  $limit) and ($offset != $mycounter - $limit)) // can display goto 
end msg
{
$lastinsert = Go To End  [input] |\ [input]  [input]  [input] ;
if($searchenquiry)
$lastinsert .=  [input] ;
if($scholarsenquiry)
$lastinsert .=  [input] ;
if($titlesenquiry)
$lastinsert .=  [input] ;
$lastinsert .= ;
}
#
### $firstinsert 
#

$new_offset4 = $mycounter - $limit;
if ($new_offset4  $limit) // can display goto beginning msg
{
$new_offset4 = 0;
$firstinsert =  [input]  Go To Beginning [input]  [input]  [input] ;
if($searchenquiry)
$firstinsert .=  [input] ;
if($scholarsenquiry)
$firstinsert .=  [input] ;
if($titlesenquiry)
$firstinsert .=  [input] ;
$firstinsert .= ;
}


#
### Display Inserts #
#

#
if (($previousinsert) or ($nextinsert))
#echo ;
echo ;

#if (($previousinsert) || ($nextinsert))
#echo (Sorted by id - $mycounter records found total);

if (($previousinsert) or ($nextinsert))
echo ;

if (($firstinsert) and ($offset != 0)) echo $firstinsert;

if ($previousinsert) echo $previousinsert;

if (($previousinsert)  ($nextinsert)) echo | ;

if ($nextinsert) echo $nextinsert;

if ($lastinsert) echo $lastinsert;

if (($previousinsert) or ($nextinsert))
#echo ;
echo ;

?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

 

-
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!