[PHP-DB] date: reverse order
hello, when retrieving data from the db and displaying it on the page by creation date how can i reverse the order so that the most recent entry appears first? here's what i have now: require("config.php"); $obj = mysql_db_query($dbname,"select * from ads order by createdate"); ?> thank you addison -- Addison Ellis small independent publishing co. 114 B 29th Avenue North Nashville, TN 37203 (615) 321-1791 [EMAIL PROTECTED] [EMAIL PROTECTED] subsidiaries of small independent publishing co. [EMAIL PROTECTED] [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Popup
Como faço para criar uma janela de popup em php? O objectivo é ao abrir uma página com dados estatisticos abrir outra com gráficos. xau __ Rui Palma ICQ#: 171381429 Current ICQ status: + More ways to contact me __
[PHP-DB] Storing iterated results into various variables
May be some one could help me here, I am trying to retrieve results from a table that gives 9 rows, from each row I am trying to pull out two fields and assign the two values of those column fields to a variable $image1 and $caption1, and now I want to go to the next row and pick up the values of the corresponding fields and store it in the next variable $image2 and $caption2 and to continue until I reach 9 rows. The reason for this technique is I am trying to inject the dynamic data inside a page which is already formatted with HTMLs (kind of template) and by means of Php tags I can echo these variables where needed. Thanks for your time and help in advance I'd appreciate it. GD -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] update
Hello, Newbie question. And can the same SQL portion of the code be written something like... query= "UPDATE taablename SET (username, email, location) VALUEs( $username, $email, $location)"; Any reason why this Update command would not execute? // BUILD AND EXECUTE QUERY TO SAVE USER INFO INTO DATABASE TABLE query = "UPDATE forumUsers SET username = '$name' WHERE userID = '$id'"; result = @mysql_query($query); query2 = "UPDATE forumUsers SET email = '$emai' WHERE userID = '$id'"; result2 = @mysql_query($query2); query3 = "UPDATE forumUsers SET Location = '$loc' WHERE userID = '$id'"; result3 = @mysql_query($query3); / INFORM FLASH OF SUCCESS print "&/:result=Updated Thanks"; // CLOSE LINK TO DATABASE SERVER ysql_close($link); ?> Ike -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] date: reverse order
> when retrieving data from the db and displaying it on the > page by creation date how can i reverse the order so that the most > recent entry appears first? here's what i have now: > > require("config.php"); > > $obj = mysql_db_query($dbname,"select * from ads order by createdate"); > ?> You rely on the list to much for simple questions. SELECT * FROM ads ORDER BY createdate DESC ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] problem with charsets mssql/mysql php
Hi, This is the problem I am having: I have to extract data from MS SQL into MY SQL using PHP. The MS SQL (puke!) runs on a (yuck!) MS Small Business Server. It contains text fields that contain text with characters like ë, ö, é, è (Dutch language). The MY SQL used to run on Windows 2000. The strings that were read from the MS SQL and put into the MY SQL were identical. Due to a security leak (hah) I installed OpenBSD on the same machine, used be-latin1 local settings. I also managed to get MYSQL working under OpenBSD. The problem is now... when i insert something like this into the mysql: insert into table(field) values("This is a test. ë."); and i want to output that string from the MYSQL running on OpenBSD, i get this: "This is a test. ?." so you see the weird character in stead of the ë. How can i resolve this quickly? Thank you for the help ! Kind regards, Filip -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] date: reverse order
Simple MySQL. After your ORDER BY clause use either ASC (I think this is the default) or DESC. I'm pretty sure this'll work on date fields to produce the results you want. Your query will end up looking like: "...order by createdate DESC" > -Original Message- > From: Addison Ellis [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, February 04, 2003 5:28 AM > To: [EMAIL PROTECTED] > Subject: [PHP-DB] date: reverse order > > > hello, > when retrieving data from the db and displaying it on the > page by creation date how can i reverse the order so that the most > recent entry appears first? here's what i have now: > > require("config.php"); > > $obj = mysql_db_query($dbname,"select * from ads > order by createdate"); > ?> > > > thank you addison > -- > Addison Ellis > small independent publishing co. > 114 B 29th Avenue North > Nashville, TN 37203 > (615) 321-1791 > [EMAIL PROTECTED] > [EMAIL PROTECTED] > subsidiaries of small independent publishing co. > [EMAIL PROTECTED] > [EMAIL PROTECTED] > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] date: reverse order
thank you... this worked. best, addison Simple MySQL. After your ORDER BY clause use either ASC (I think this is the default) or DESC. I'm pretty sure this'll work on date fields to produce the results you want. Your query will end up looking like: "...order by createdate DESC" -Original Message- From: Addison Ellis [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 04, 2003 5:28 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] date: reverse order hello, when retrieving data from the db and displaying it on the page by creation date how can i reverse the order so that the most recent entry appears first? here's what i have now: thank you addison -- Addison Ellis small independent publishing co. 114 B 29th Avenue North Nashville, TN 37203 (615) 321-1791 [EMAIL PROTECTED] [EMAIL PROTECTED] subsidiaries of small independent publishing co. [EMAIL PROTECTED] [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Addison Ellis small independent publishing co. 114 B 29th Avenue North Nashville, TN 37203 (615) 321-1791 [EMAIL PROTECTED] [EMAIL PROTECTED] subsidiaries of small independent publishing co. [EMAIL PROTECTED] [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] print_r($row);
hello, i do print_r($row); and all my data is printing properly from my db. however, with the below code only one row is not printing: {$row->property_type} thank you for your time. addison // Begin Ad Block $count = 0; $id = 45; $obj = mysql_db_query($dbname,"select a.*,s.name as subcategory_name,c.name as category_name from ads a,subcategory s, category c where a.subcategory=s.id and s.category=c.id and a.subcategory=$id and a.que='checked'"); if ($obj && mysql_num_rows($obj)>0) { while($row = mysql_fetch_object($obj)) { $count++; ?> bedrooms}Bedroom/{$row->baths}Bath {$row->property_type} {$row->description} {$row->distance} from campus. Available: {$row->date_available} {$row->price} Contact: {$row->contact}"; ?> } } // End Ad Block ?> this is what is printing: 2Bedroom/2Bath great place less than 5 miles From Campus Available immediately $500.00/month Contact: 321-1791 -- Addison Ellis small independent publishing co. 114 B 29th Avenue North Nashville, TN 37203 (615) 321-1791 [EMAIL PROTECTED] [EMAIL PROTECTED] subsidiaries of small independent publishing co. [EMAIL PROTECTED] [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] print_r($row);
> i do print_r($row); and all my data is printing properly from > my db. however, with the below code only one row is not printing: > {$row->property_type} > thank you for your time. addison > > // Begin Ad Block > $count = 0; > $id = 45; > $obj = mysql_db_query($dbname,"select a.*,s.name as > subcategory_name,c.name as category_name from ads a,subcategory s, > category c where a.subcategory=s.id and s.category=c.id and > a.subcategory=$id and a.que='checked'"); > if ($obj && mysql_num_rows($obj)>0) { > while($row = mysql_fetch_object($obj)) > { > $count++; > ?> >bedrooms}Bedroom/{$row->baths}Bath > {$row->property_type} >{$row->description} >{$row->distance} from campus. >Available: {$row->date_available} >{$row->price} >Contact: {$row->contact}"; > ?> > > > > > } > } > // End Ad Block > ?> > > this is what is printing: > > 2Bedroom/2Bath great place less than 5 miles From Campus Available > immediately $500.00/month > Contact: 321-1791 What does the print_r() actually look like? Make sure the cases match, $row->Test is not the same as $row->TEST. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] update
UPDATE is for changing values in existing rows. It appears you want to add new information. Use INSERT. $query= "INSERT tablename SET (username, email, location) VALUES( $username, $email, $location)"; Note that a WHERE condition is incorrect for INSERT. Your UPDATE syntax is not correct either. Note that you need only one query to update any or all of the columns in a row. Using your example: $query="UPDATE tablename SET username=$username, email=$email, location=$location WHERE userID=$id"; Finally, your "Flash of Success" is not useful because it will print even when the query fails. Doug On Thu, 30 Jan 2003 13:34:41 -0500, Ike Austin wrote: >Hello, Newbie question. > >And can the same SQL portion of the code be written something like... >query= "UPDATE taablename SET (username, email, location) >VALUEs( $username, $email, $location)"; > >Any reason why this Update command would not execute? > >// BUILD AND EXECUTE QUERY TO SAVE USER INFO INTO DATABASE TABLE >query = "UPDATE forumUsers SET username = '$name' WHERE userID = '$id'"; >result = @mysql_query($query); >query2 = "UPDATE forumUsers SET email = '$emai' WHERE userID = '$id'"; >result2 = @mysql_query($query2); >query3 = "UPDATE forumUsers SET Location = '$loc' WHERE userID = '$id'"; >result3 = @mysql_query($query3); > >/ INFORM FLASH OF SUCCESS >print "&/:result=Updated Thanks"; >// CLOSE LINK TO DATABASE SERVER >ysql_close($link); >?> > > >Ike -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Storing iterated results into various variables
On Tuesday 04 February 2003 20:02, Geckodeep wrote: > May be some one could help me here, I am trying to retrieve results from a > table that gives 9 rows, from each row I am trying to pull out two fields > and assign the two values of those column fields to a variable $image1 and > $caption1, and now I want to go to the next row and pick up the values of > the corresponding fields and store it in the next variable $image2 and > $caption2 and to continue until I reach 9 rows. > > The reason for this technique is I am trying to inject the dynamic data > inside a page which is already formatted with HTMLs (kind of template) and > by means of Php tags I can echo these variables where needed. What exactly are you having problems with? What is your code so far? -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Ah, sweet Springtime, when a young man lightly turns his fancy over! */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] update
If you want to use WHERE clause, see the INSERT table SELECT ... syntax. Extremely convenient. You inherit all the flexibility of the SELECT statement. Ignatius - Original Message - From: "Doug Thompson" <[EMAIL PROTECTED]> To: "Ike Austin" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, February 04, 2003 2:17 PM Subject: Re: [PHP-DB] update > UPDATE is for changing values in existing rows. It appears you want to > add new information. Use INSERT. > > $query= "INSERT tablename SET (username, email, location) VALUES( > $username, $email, $location)"; > Note that a WHERE condition is incorrect for INSERT. > > Your UPDATE syntax is not correct either. Note that you need only one > query to update any or all of the columns in a row. > > Using your example: > > $query="UPDATE tablename SET username=$username, email=$email, > location=$location WHERE userID=$id"; > > Finally, your "Flash of Success" is not useful because it will print > even when the query fails. > > Doug > > On Thu, 30 Jan 2003 13:34:41 -0500, Ike Austin wrote: > > >Hello, Newbie question. > > > >And can the same SQL portion of the code be written something like... > >query= "UPDATE taablename SET (username, email, location) > >VALUEs( $username, $email, $location)"; > > > >Any reason why this Update command would not execute? > > > >// BUILD AND EXECUTE QUERY TO SAVE USER INFO INTO DATABASE TABLE > >query = "UPDATE forumUsers SET username = '$name' WHERE userID = '$id'"; > >result = @mysql_query($query); > >query2 = "UPDATE forumUsers SET email = '$emai' WHERE userID = '$id'"; > >result2 = @mysql_query($query2); > >query3 = "UPDATE forumUsers SET Location = '$loc' WHERE userID = '$id'"; > >result3 = @mysql_query($query3); > > > >/ INFORM FLASH OF SUCCESS > >print "&/:result=Updated Thanks"; > >// CLOSE LINK TO DATABASE SERVER > >ysql_close($link); > >?> > > > > > >Ike > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] How activate the support for MySQL?
Hello, how can I activate the support for MySQL, because when I try to use functions as mysql_connect or mysql_select_db I receipt this error message: Call to undefined function... Thank you very much, Tom. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] How activate the support for MySQL?
On Tuesday 04 February 2003 21:31, Tomás Liendo wrote: > Hello, how can I activate the support for MySQL, because when I try to use > functions as mysql_connect or mysql_select_db I receipt this error message: > Call to undefined function... It depends on how you installed php. Searching archives for "Call to undefined function mysql_connect" will probably cover all the common cases. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* FEELINGS are cascading over me!!! */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Storing iterated results into various variables
Here is a part of my code: while ($image_row = mysql_fetch_array($result_images)){ $image1 = $image_row[0]["image1"]; if ($image1 == ""){ $image1 = $folder."logo.jpg";// it places a log when there are no images } $caption1 = $image_row[0]["caption"]; } This loop fetches the row and assigns the two variables $image1 and $caption1 with its associated value from the fields in the 1st row. How can I get the loop to fetch in the same way as above but from the 2nd row and assigns the values to the new variable $image2 and $caption2 until it reaches the 9th row with $image9 and $caption9? thanks again "Jason Wong" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On Tuesday 04 February 2003 20:02, Geckodeep wrote: > > May be some one could help me here, I am trying to retrieve results from a > > table that gives 9 rows, from each row I am trying to pull out two fields > > and assign the two values of those column fields to a variable $image1 and > > $caption1, and now I want to go to the next row and pick up the values of > > the corresponding fields and store it in the next variable $image2 and > > $caption2 and to continue until I reach 9 rows. > > > > The reason for this technique is I am trying to inject the dynamic data > > inside a page which is already formatted with HTMLs (kind of template) and > > by means of Php tags I can echo these variables where needed. > > What exactly are you having problems with? What is your code so far? > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.biz > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > -- > Search the list archives before you post > http://marc.theaimsgroup.com/?l=php-db > -- > /* > Ah, sweet Springtime, when a young man lightly turns his fancy over! > */ > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Storing iterated results into various variables
$counter = 1; $query = mysql_query("SELECT image,caption FROM tablename ORDER BY id;"); while($row = mysql_fetch_array($query)) { $imagevar = "image" . $counter; $captionvar = "caption" . $counter; $$imagevar = $row[image]; $$captionvar = $row[caption]; $counter++; } Change the query to match what you need, and that should work, if your interested, check out the manual page on "Variable Variables" at: http://www.php.net/manual/en/language.variables.variable.php Enjoy. On Tue, 2003-02-04 at 07:02, Geckodeep wrote: May be some one could help me here, I am trying to retrieve results from a table that gives 9 rows, from each row I am trying to pull out two fields and assign the two values of those column fields to a variable $image1 and $caption1, and now I want to go to the next row and pick up the values of the corresponding fields and store it in the next variable $image2 and $caption2 and to continue until I reach 9 rows. The reason for this technique is I am trying to inject the dynamic data inside a page which is already formatted with HTMLs (kind of template) and by means of Php tags I can echo these variables where needed. Thanks for your time and help in advance I'd appreciate it. GD -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Adam Voigt ([EMAIL PROTECTED]) The Cryptocomm Group My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc signature.asc Description: This is a digitally signed message part
Re: [PHP-DB] update
INSERT ... SELECT is for inserting values from another table into the current one. That is a different circumstance than what was described in the original inquiry. http://www.mysql.com/doc/en/INSERT.html On Tue, 4 Feb 2003 14:32:45 +0100, Ignatius Reilly wrote: >If you want to use WHERE clause, see the > >INSERT table >SELECT ... > >syntax. > >Extremely convenient. You inherit all the flexibility of the SELECT >statement. > >Ignatius > >- Original Message - >From: "Doug Thompson" <[EMAIL PROTECTED]> >To: "Ike Austin" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> >Sent: Tuesday, February 04, 2003 2:17 PM >Subject: Re: [PHP-DB] update > > >> UPDATE is for changing values in existing rows. It appears you want to >> add new information. Use INSERT. >> >> $query= "INSERT tablename SET (username, email, location) VALUES( >> $username, $email, $location)"; >> Note that a WHERE condition is incorrect for INSERT. >> >> Your UPDATE syntax is not correct either. Note that you need only one >> query to update any or all of the columns in a row. >> >> Using your example: >> >> $query="UPDATE tablename SET username=$username, email=$email, >> location=$location WHERE userID=$id"; >> >> Finally, your "Flash of Success" is not useful because it will print >> even when the query fails. >> >> Doug >> >> On Thu, 30 Jan 2003 13:34:41 -0500, Ike Austin wrote: >> >> >Hello, Newbie question. >> > >> >And can the same SQL portion of the code be written something like... >> >query= "UPDATE taablename SET (username, email, location) >> >VALUEs( $username, $email, $location)"; >> > >> >Any reason why this Update command would not execute? >> > >> >// BUILD AND EXECUTE QUERY TO SAVE USER INFO INTO DATABASE TABLE >> >query = "UPDATE forumUsers SET username = '$name' WHERE userID = '$id'"; >> >result = @mysql_query($query); >> >query2 = "UPDATE forumUsers SET email = '$emai' WHERE userID = '$id'"; >> >result2 = @mysql_query($query2); >> >query3 = "UPDATE forumUsers SET Location = '$loc' WHERE userID = '$id'"; >> >result3 = @mysql_query($query3); >> > >> >/ INFORM FLASH OF SUCCESS >> >print "&/:result=Updated Thanks"; >> >// CLOSE LINK TO DATABASE SERVER >> >ysql_close($link); >> >?> >> > >> > >> >Ike >> >> >> >> -- >> PHP Database Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > > >-- >PHP Database Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Storing iterated results into various variables
thanks i m going to test ride it and let you know. tks again to adam & jason. "Adam Voigt" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... $counter = 1; $query = mysql_query("SELECT image,caption FROM tablename ORDER BY id;"); while($row = mysql_fetch_array($query)) { $imagevar = "image" . $counter; $captionvar = "caption" . $counter; $$imagevar = $row[image]; $$captionvar = $row[caption]; $counter++; } Change the query to match what you need, and that should work, if your interested, check out the manual page on "Variable Variables" at: http://www.php.net/manual/en/language.variables.variable.php Enjoy. On Tue, 2003-02-04 at 07:02, Geckodeep wrote: May be some one could help me here, I am trying to retrieve results from a table that gives 9 rows, from each row I am trying to pull out two fields and assign the two values of those column fields to a variable $image1 and $caption1, and now I want to go to the next row and pick up the values of the corresponding fields and store it in the next variable $image2 and $caption2 and to continue until I reach 9 rows. The reason for this technique is I am trying to inject the dynamic data inside a page which is already formatted with HTMLs (kind of template) and by means of Php tags I can echo these variables where needed. Thanks for your time and help in advance I'd appreciate it. GD -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Adam Voigt ([EMAIL PROTECTED]) The Cryptocomm Group My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: problems with variables
Just a quick correction... if the "q" part is static, I believe you should use $(q$i) rather than ${$q . $i} --- [EMAIL PROTECTED] wrote: > OK, now I get it: > > $input = '" . "\n"; > > print($input); > > This one isn't well known so don't forget it!! ;) > > Larry > > > Marcel <[EMAIL PROTECTED]> wrote: > > Sorry, I see that I've got the a's and q's mixed up. > > I'll try to clarify it some more by giving an example with 2 > variables. > > > $q1 = "first_var"; > > $q2 = "second_var"; > > for($i=1;$i<=2;$i++) > > { > >echo "\n"; > > } > > The output should now be: > > > > > > > Hope you can help me, > > Marcel > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > = Mark Weinstock [EMAIL PROTECTED] *** You can't demand something as a "right" unless you are willing to fight to death to defend everyone else's right to the same thing. -Stolen from the now-defunct Randy's Random mailing list. *** __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Storing iterated results into various variables
finally i got it to work in this manner. $i=1; while ($image_row = mysql_fetch_array($result_images)){ $image="image".$i; $caption="caption".$i; $$image = $image_row["image1"]; if ($$image == ""){ $$image = $folder."logo.jpg"; } $$caption = $image_row["caption"]; $i++; } great so thanks Adams. GD "Geckodeep" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > thanks i m going to test ride it and let you know. > tks again to adam & jason. > > "Adam Voigt" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > $counter = 1; > $query = mysql_query("SELECT image,caption FROM tablename ORDER BY id;"); > > while($row = mysql_fetch_array($query)) > { > > $imagevar = "image" . $counter; > $captionvar = "caption" . $counter; > > $$imagevar = $row[image]; > $$captionvar = $row[caption]; > > $counter++; > > } > > Change the query to match what you need, and that should work, if > your interested, check out the manual page on "Variable Variables" at: > > http://www.php.net/manual/en/language.variables.variable.php > > Enjoy. > > On Tue, 2003-02-04 at 07:02, Geckodeep wrote: > May be some one could help me here, I am trying to retrieve results from a > table that gives 9 rows, from each row I am trying to pull out two fields > and assign the two values of those column fields to a variable $image1 and > $caption1, and now I want to go to the next row and pick up the values of > the corresponding fields and store it in the next variable $image2 and > $caption2 and to continue until I reach 9 rows. > > The reason for this technique is I am trying to inject the dynamic data > inside a page which is already formatted with HTMLs (kind of template) and > by means of Php tags I can echo these variables where needed. > > > > Thanks for your time and help in advance I'd appreciate it. > > > > GD > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- > Adam Voigt ([EMAIL PROTECTED]) > The Cryptocomm Group > My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Oracle 9.2 + IIS 5.0 + Win2k server + PHP 4.3 + ADODB 3.10
Daniel Joyce <[EMAIL PROTECTED]> wrote... : > > Hello folks, I need help with the following. I'm recording machine > production and 'health' status information into a Oracle 9.2 DB. That's > working great, rock solid, great admin tools, etc. > > I've been trying to use the Rockwell Software tools to get the data out onto > the web in a pretty format, but Rockwell's tools are brittle, buggy, and > overpriced. Also, ASP + VBScript for my hacks is turning out to be crufty > and slow. > > I have Oracle 9.2 sitting on a Win2k server that is the primary domain > controller. I've set up IIS with PHP, and everything is working great... It > can see all the extensions, and with a change to the permissions of the > oci.dll, PHP can see that too. > > I'm wanting to use ADODB 3.1 as a cleaner interface to the Oracle database > via oci8. But no matter what I try, I get errors. These errors are not the > "access is denied" error I saw when oci.dll had the wrong perms. It seems I > get a warning in the ado... > > Here is the code snippet from the testpage, tnsname has been changed to > protect the guilty... ;) > > -- > This is the dbtest.php file, based on samples given on the adodb page > -- > > include('.\adodb\adodb.inc.php'); # load code common to ADOdb > include('.\adodb\tohtml.inc.php'); > $conn = &ADONewConnection('oci8'); # create a connection > # connect to Oracle OCI8 DB... > $conn->debug=true; > $conn->NConnect('', 'usr', 'usr_pwd', 'TNSName'); > # select machines from machinetable > $recordSet = $conn->Execute("select * from machinetable"); > > if (!$recordSet) > print $conn->ErrorMsg(); > else > while (!$recordSet->EOF) { > print $recordSet->fields[0].' '.$recordSet->fields[1].''; > $recordSet->MoveNext(); > } > > #$recordSet->Close(); # optional > #$conn->Close(); # optional > > ?> > > -- > This is the error I get in my HTML page, when I browse to dbtest.php > -- > > Warning: _oci_open_server: in > D:\PHP\includes\adodb\drivers\adodb-oci8.inc.php on line 132 > > : > (oci8): select * from machinetable > : > > --- > > adodb-oci8.inc.php is part of the adodb package, and I am getting a warning > at that line in the ADODB code. > > Is this a bug? Should I try ADODB 2.5 instead since it's listed as being > more stable on the site? > > Any and all help will be greatly appreciated. I'm trying to get a demo app > up and running in a few days so they don't think I'm nuts for trying > this... <:) Daniel, I maintain the OCI8 extension and, I have already heard a complain similar to this (ADODB, PHP 4.3, Oracle 9.*). Yes, I'd like to know what would happen with AdoDB 2.5 and PHP 4.3.0 for your case. Can you please test ADODB 2.5 and tell me the results? Also, try the latest CVS at snaps.php.net (php4) and see whether this error persists there. Thanks -- Maxim Maletsky [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Help!
Have you correctly updated you web server's .ini file to point to the PHP installation according to the PHP installation instructions? > -Original Message- > From: Tomas Liendo [mailto:[EMAIL PROTECTED]] > Sent: Monday, February 03, 2003 10:29 PM > To: [EMAIL PROTECTED] > Subject: [PHP-DB] Help! > > > Hello I'm a beginner, I'm reading the PHP's manual but I > can't test the > examples because always receipt the following error message: > > Call to undefined funciont: > > I can't understand why! Please help... :-( > > Thank you very much, > > Tom. > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Date Range Question...
I am working on an app that needs to post information to a website based on date. The tricky part for me is that the date is a range that spans either 2 or 3 days. I want the web page to dynamically populate this information based on a query. The query will look something like this: mysql("Calendar2","SELECT StartDate, StopDate, LocationID FROM phpCalendar_Daily WHERE StartDate=CURDATE() ") My question is say for example the StartDate is actually Jan. 1. The page is accessed on Jan. 2 or Jan. 3... The StartDate for the next entry is Jan. 4. How do I write this query to select the proper entry? In doing some research, it appears that a MySQL "SELECT CASE" might do the trick, but I have never used this before. The other option I can envision is using PHP to handle the login and simply running the query, testing the result, if NULL, run the query again with CURDATE(-1). Any hints, ideas, or suggestions would be most appreciated. Thanks in advance. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Date Range Question...
> I am working on an app that needs to post information to a website > based on date. The tricky part for me is that the date is a range that > spans either 2 or 3 days. I want the web page to dynamically populate this > information based on a query. The query will look something like this: > mysql("Calendar2","SELECT StartDate, StopDate, LocationID FROM > phpCalendar_Daily WHERE StartDate=CURDATE() ") > > My question is say for example the StartDate is actually Jan. 1. > The page is accessed on Jan. 2 or Jan. 3... The StartDate for the next > entry is Jan. 4. How do I write this query to select the proper entry? In > doing some research, it appears that a MySQL "SELECT CASE" might do the > trick, but I have never used this before. The other option I can envision > is using PHP to handle the login and simply running the query, testing the > result, if NULL, run the query again with CURDATE(-1). > Any hints, ideas, or suggestions would be most appreciated. Thanks > in advance. If I understand you correctly, I think you could use something like this: SELECT StartDate, StopDate, LocationID FROM phpCalendar_Daily WHERE StartDate BETWEEN CURDATE() AND CURDATE() - INTERVAL $x DAY Where $x is 2 or 3, depending on your case. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Date Range Question...
WOW... I have never even heard of BETWEEN before. How does this look to you? SELECT StartDate, StopDate, LocationID FROM phpCalendar_Daily WHERE CURDATE() BETWEEN StopDate AND StopDate Would the query work like this? This would mean I don't even have to care about the difference of 2 or 3 days? -Original Message- From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 04, 2003 10:04 AM To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED] Subject: Re: [PHP-DB] Date Range Question... > I am working on an app that needs to post information to a website > based on date. The tricky part for me is that the date is a range that > spans either 2 or 3 days. I want the web page to dynamically populate this > information based on a query. The query will look something like this: > mysql("Calendar2","SELECT StartDate, StopDate, LocationID FROM > phpCalendar_Daily WHERE StartDate=CURDATE() ") > > My question is say for example the StartDate is actually Jan. 1. > The page is accessed on Jan. 2 or Jan. 3... The StartDate for the next > entry is Jan. 4. How do I write this query to select the proper entry? In > doing some research, it appears that a MySQL "SELECT CASE" might do the > trick, but I have never used this before. The other option I can envision > is using PHP to handle the login and simply running the query, testing the > result, if NULL, run the query again with CURDATE(-1). > Any hints, ideas, or suggestions would be most appreciated. Thanks > in advance. If I understand you correctly, I think you could use something like this: SELECT StartDate, StopDate, LocationID FROM phpCalendar_Daily WHERE StartDate BETWEEN CURDATE() AND CURDATE() - INTERVAL $x DAY Where $x is 2 or 3, depending on your case. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] HELP, sendmail + mysql.
Hi, need some help. i will try to explain my self. I have a sendmail in GNU/linux, and a radiator GNU/Linux with Mysql. I have to give a diferente user for de dialup login and the sendmail, cause i can't or i dont know a way to change the user and pass for the user in the two servers. Like this, the user to make a dialup conection has a user and a pass and for the sendmail has another, and, if there is any changes, when the user changes de user or pass from one can't at the same time change the user/pass from the other. can someone help me Cumprimentos Bruno Pereira [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] matching data from one table with another and displaying results?
Hi All, Having a problem figuring out the logic of something here and hoping someone can point me in the right direction. I have 2 tables. First table holds a listing of all Provinces and States. Here a brief of what it looks like: value label AB Alberta BC British Columbia MB Manitobia NF Newfoundland NT Northwest Territories NS Nova Scotia Second Table is an OrderTable which holds all order and customer info including the province/state. The province/state is dumped from the "value" column of the ProvinceTable. Meaning.. an order record would show the province as "AB" or "NS" instead of "Alberta" or "Nova Scotia". I am creating an order report and in this report I want to display the LABEL name of the Province/State that relates to an the province column in the OrderTable. I could simply just display all provinces/states from the ProvinceTable but then there would be entries for selection that had NO orders. Any idea on this? Thanks guys! Aaron
RE: [PHP-DB] matching data from one table with another and displaying results?
Seek out LEFT JOIN on mysql web site, thats what you want. Cheers Jason -Original Message- From: Aaron Wolski [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 04, 2003 10:43 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] matching data from one table with another and displaying results? Hi All, Having a problem figuring out the logic of something here and hoping someone can point me in the right direction. I have 2 tables. First table holds a listing of all Provinces and States. Here a brief of what it looks like: value label AB Alberta BC British Columbia MB Manitobia NF Newfoundland NT Northwest Territories NS Nova Scotia Second Table is an OrderTable which holds all order and customer info including the province/state. The province/state is dumped from the "value" column of the ProvinceTable. Meaning.. an order record would show the province as "AB" or "NS" instead of "Alberta" or "Nova Scotia". I am creating an order report and in this report I want to display the LABEL name of the Province/State that relates to an the province column in the OrderTable. I could simply just display all provinces/states from the ProvinceTable but then there would be entries for selection that had NO orders. Any idea on this? Thanks guys! Aaron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] matching data from one table with another and displaying results? SOLVED
Solved the issue... Just thought I'd post the query that did it. $provinceQuery = db_query("SELECT * FROM ProvinceSelectTable AS t1, OrderTable AS t2 WHERE t1.value=t2.province GROUP BY t2.province"); Thanks for any help thought to provide me :) Aaron -Original Message- From: SELPH,JASON (HP-Richardson,ex1) [mailto:[EMAIL PROTECTED]] Sent: February 4, 2003 11:59 AM To: Aaron Wolski; [EMAIL PROTECTED] Subject: RE: [PHP-DB] matching data from one table with another and displaying results? Seek out LEFT JOIN on mysql web site, thats what you want. Cheers Jason -Original Message- From: Aaron Wolski [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 04, 2003 10:43 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] matching data from one table with another and displaying results? Hi All, Having a problem figuring out the logic of something here and hoping someone can point me in the right direction. I have 2 tables. First table holds a listing of all Provinces and States. Here a brief of what it looks like: value label AB Alberta BC British Columbia MB Manitobia NF Newfoundland NT Northwest Territories NS Nova Scotia Second Table is an OrderTable which holds all order and customer info including the province/state. The province/state is dumped from the "value" column of the ProvinceTable. Meaning.. an order record would show the province as "AB" or "NS" instead of "Alberta" or "Nova Scotia". I am creating an order report and in this report I want to display the LABEL name of the Province/State that relates to an the province column in the OrderTable. I could simply just display all provinces/states from the ProvinceTable but then there would be entries for selection that had NO orders. Any idea on this? Thanks guys! Aaron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] matching data from one table with another and displaying results?
I have a JOIN that is not working, and figured I would piggie-back on this thread to see if someone could give me a quick answer... Here is the JOIN syntax. This is my very first attempt at a JOIN statement, so I may be doing something blatantly wrong here. SELECT 'A.Title' FROM `phpCalendar_Daily` AS 'B' JOIN 'phpCalendar_Details' AS 'A' ON 'B.CalendarDetailsID' = 'A.CalendarDetailsID' WHERE CURDATE( ) BETWEEN 'StartDate' AND 'StopDate' I am attempting this from the SQL window of phpMyAdmin, so this is not embedded somewhere in a script and failing. Thanks in advance. -Original Message- From: SELPH,JASON (HP-Richardson,ex1) [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 04, 2003 10:59 AM To: Aaron Wolski; [EMAIL PROTECTED] Subject: RE: [PHP-DB] matching data from one table with another and displa ying results? Seek out LEFT JOIN on mysql web site, thats what you want. Cheers Jason -Original Message- From: Aaron Wolski [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 04, 2003 10:43 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] matching data from one table with another and displaying results? Hi All, Having a problem figuring out the logic of something here and hoping someone can point me in the right direction. I have 2 tables. First table holds a listing of all Provinces and States. Here a brief of what it looks like: value label AB Alberta BC British Columbia MB Manitobia NF Newfoundland NT Northwest Territories NS Nova Scotia Second Table is an OrderTable which holds all order and customer info including the province/state. The province/state is dumped from the "value" column of the ProvinceTable. Meaning.. an order record would show the province as "AB" or "NS" instead of "Alberta" or "Nova Scotia". I am creating an order report and in this report I want to display the LABEL name of the Province/State that relates to an the province column in the OrderTable. I could simply just display all provinces/states from the ProvinceTable but then there would be entries for selection that had NO orders. Any idea on this? Thanks guys! Aaron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: problems with variables
> -Original Message- > From: Mark [mailto:[EMAIL PROTECTED]] > Sent: 04 February 2003 14:38 > > Just a quick correction... if the "q" part is static, I believe you > should use $(q$i) rather than ${$q . $i} Well, actually, I think you want ${'q'.$i} -- or even ${"q$i"} Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 > --- [EMAIL PROTECTED] wrote: > > OK, now I get it: > > > > $input = '" . "\n"; > > > > print($input); > > > > This one isn't well known so don't forget it!! ;) > > > > Larry > > > > > > Marcel <[EMAIL PROTECTED]> wrote: > > > Sorry, I see that I've got the a's and q's mixed up. > > > I'll try to clarify it some more by giving an example with 2 > > variables. > > > > > $q1 = "first_var"; > > > $q2 = "second_var"; > > > for($i=1;$i<=2;$i++) > > > { > > >echo "\n"; > > > } > > > The output should now be: > > > > > > > > > > > Hope you can help me, > > > Marcel > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > = > Mark Weinstock > [EMAIL PROTECTED] > *** > You can't demand something as a "right" unless you are > willing to fight to death to defend everyone else's right to > the same thing. > -Stolen from the now-defunct Randy's Random mailing list. > *** > > __ > Do you Yahoo!? > Yahoo! Mail Plus - Powerful. Affordable. Sign up now. > http://mailplus.yahoo.com > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Agata Report :: New Version 4 beta 002
Agata Report :: New version 4 beta 002 = Where can I get ? - http://agata.codigolivre.org.br Changes ? Table Structure Tree and SQL Repository Tree have new features and new design. A new directory structure is now used. The merge tool was redesigned. A del button was added to SelectList. Parameters may now be used on queries (using $whatever). A Spanish version was added. Oracle is now supported through Pear. What is ? --- Agata Report is a Database Reporting Tool, like Crystal Reports. Its written in PHP-GTK with PEAR and allows you to edit and get SQL results from several databases. There is a merge tool that merges DB results into a document, there's a tool for address label generation, ER diagrams are generated automatically from DB too. Agata allows you to create reports with many levels of grouped data with subtotals and grand totals, beyond run-time parameters. There are versions in English, Portuguese, Spanish, Italian, French, Deutsch and Swedish. Agata support different themes too. It connects to database, which can be PostgreSQL, MySQL, Oracle, DB2, MsSql, Informix or InterBase, lists its tables, fields and allows linking among tables, make constraints, orders, to group data, to apply functions and make queries. It generates results to PostScript or Text file. :: Pablo Dall'Oglio ([EMAIL PROTECTED]) :: Univates - IT Department +55 (51) 3714-7040 :: Linux User n. 223253, Lajeado, RS - Brasil :: Life is a jorney, not a destination. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] A little JOIN help please...
This is more of an SQL question, but I am not sure where else to turn for help. I am trying a JOIN, for the first time ever, and it is NOT working for me. The following is what I am attempting; SELECT 'A.Title' FROM `phpCalendar_Daily` AS 'B' JOIN 'phpCalendar_Details' AS 'A' ON 'A.CalendarDetailsID' = 'B.CalendarDetailsID' WHERE CURDATE( ) BETWEEN 'B.StartDate' AND 'B.StopDate' This is simply in a SQL command window in phpMyAdmin, and it is returning an error. I have tried messing around with the quotes, and everything else I can think of. Someone please let me know what I am doing wrong. Thanks. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] A little JOIN help please...
> SELECT 'A.Title' > FROM `phpCalendar_Daily` AS 'B' > JOIN 'phpCalendar_Details' AS 'A' ON 'A.CalendarDetailsID' = > 'B.CalendarDetailsID' > WHERE CURDATE( ) > BETWEEN 'B.StartDate' AND 'B.StopDate' Take out all of those quotes! You're making strings out of everything. WHERE CURDATE() BETWEEN 'string' AND 'anotherstring' etc... ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] A little JOIN help please...
Thanks... I was able to figure it out using what my book calls the old method. Here is what ended up working for me: SELECT B.Title FROM `phpCalendar_Details` AS B, `phpCalendar_Daily` AS A WHERE A.CalendarDetailsID = B.CalendarDetailsID AND CURDATE( ) BETWEEN A.StartDate AND A.StopDate -Original Message- From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 04, 2003 1:36 PM To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED] Subject: Re: [PHP-DB] A little JOIN help please... > SELECT 'A.Title' > FROM `phpCalendar_Daily` AS 'B' > JOIN 'phpCalendar_Details' AS 'A' ON 'A.CalendarDetailsID' = > 'B.CalendarDetailsID' > WHERE CURDATE( ) > BETWEEN 'B.StartDate' AND 'B.StopDate' Take out all of those quotes! You're making strings out of everything. WHERE CURDATE() BETWEEN 'string' AND 'anotherstring' etc... ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] How to check that today's date is within a given range
I have a start_date and a finish_date stored in a mysql db. I want to check that today's date falls between these 2 dates. Can I set up the 3 dates so that a simple subtraction can be done? eg if (($today - $start > 0) && ($finish - $today >0)) { ...within range... } else { ...out of range... } I can't seem to find date functions that are of any use for this. Thanks in advance. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] odbc query with single quote in string
I'm having problem querying a table with a field value containing an appostropy, please help. Using ODBC to connect MSAcess database. $mQuery = "CustomerID='$mCust'"; $mCur2 = odbc_do( $mCnx, "select Login from Emails where $mQuery" ); When it hits "O'Donald, James", I get error in odbc_exec(). I tried variations of $mQuery, including: $mQuery = addslashes( $mQuery ); - This mail sent through ISOT. To find out more about ISOT, visit http://isot.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] "where" limits?
hello, is there a limit to how many "where" statements one can include in a query? i am wondering if i can add this: where createdate >= subdate(now(),interval 1 month)" to this: $obj = mysql_db_query($dbname,"select a.*,s.name as subcategory_name,c.name as category_name from ads a,subcategory s,category c where a.subcategory=s.id and s.category=c.id and a.subcategory=$id and a.que='checked'"); with no complications and if so, where should i insert it??? i do appreciate your time. best regards, addison -- Addison Ellis small independent publishing co. 114 B 29th Avenue North Nashville, TN 37203 (615) 321-1791 [EMAIL PROTECTED] [EMAIL PROTECTED] subsidiaries of small independent publishing co. [EMAIL PROTECTED] [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] "where" limits?
> is there a limit to how many "where" statements one can > include in a query? No... > i am wondering if i can add this: > where createdate >= subdate(now(),interval 1 month)" > > to this: > $obj = mysql_db_query($dbname,"select a.*,s.name as > subcategory_name,c.name as category_name from ads a,subcategory > s,category c where a.subcategory=s.id and s.category=c.id and > a.subcategory=$id and a.que='checked'"); Just add it onto the end ... a.que='checked' and createdate >= subdate(now(), interval 1 month)"); You could have had the answer yourself in seconds if you'd of just tried it. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] odbc query with single quote in string
> I'm having problem querying a table with a field value containing an > appostropy, please help. Using ODBC to connect MSAcess database. > >$mQuery = "CustomerID='$mCust'"; >$mCur2 = odbc_do( $mCnx, "select Login from Emails where $mQuery" ); > > When it hits "O'Donald, James", I get error in odbc_exec(). I tried > variations of $mQuery, including: > >$mQuery = addslashes( $mQuery ); You don't want to use addslashes() on $mQuery, you want to use it on the data you're inserting between the quotes, i.e. $mCust. $mQuery = "CustomerID='" . addslashes($mCust) . "'"; If that still causes an error, your database may require quotes to be escaped with another quote, instead of a backslash. In that case, you can create a function like this function addslashes2($data) { return str_replace("'","''",$data); } Hope that helps. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] How to check that today's date is within a given range
> I have a start_date and a finish_date stored in a mysql db. > > I want to check that today's date falls between these 2 dates. > > Can I set up the 3 dates so that a simple subtraction can be done? eg > > if (($today - $start > 0) && ($finish - $today >0)) { > ...within range... > } else { > ...out of range... > } > > I can't seem to find date functions that are of any use for this. I could have sworn I already answered this today... SELECT ... FROM table WHERE CURDATE() BETWEEN start AND end Where 'start' and 'end' are your columns... It's slightly faster to use CURDATE() > start AND CURDATE < end, but I find BETWEEN easier to read... ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Oracle 9.2 + IIS 5.0 + Win2k server + PHP 4.3 + ADODB 3.10
Replying to my own post Well, I got it working, using oci8. But if OCI8 works, then so should ADODB. I'll write up a post tomorrow on getting PHP and Oracle to talk under NT/2000. -Daniel -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] A little JOIN help please...
SELECT B.Title FROM phpCalendar_Details AS B, phpCalendar_Daily AS A WHERE A.CalendarDetailsID = B.CalendarDetailsID AND CURDATE( ) BETWEEN A.StartDate AND A.StopDate Also, you don't need to use the backticks around field names unless they contain spaces or other reserved words and characters. Adam
[PHP-DB] Problem with JOIN
Hi there. Im making a kind of a messageboard and trying to save some time with the querys but i cant get it to work properly. I have two tables, one with some users and one with messages. Table : users +--++ | username | id | +--++ | user1| 1 | | user2| 2 | | user3| 3 | +--++ Table : messages ++-++ | postid | replyid | id | ++-++ | 1 | 2 | 1 | | 2 | 3 | 2 | | 1 | 0 | 3 | ++-++ I have managed to create a query that selects row 1,2 but not row 3. I want mysql to return row 3 but with a NULL value on the reply id (the message dont have a reply when first posted). The output that im gettig follows... +---+---+ | post | reply | +---+-- + | user1 | user2 | | user2 | user3 | +---+---+ The ouput that i would like to have... +---+---+ | post | reply | +---+-- + | user1 | user2 | | user2 | user3 | | user1 | NULL | +---+---+ Thanks in advance. /Håkan
[PHP-DB] UPDATE doesn't work
Hello all, I'm a graphic designer making a site for giving tutorials, but since i'm just a newbie in coding, tons of problems have fallen on me. This is my photoshop_tutorial table structure id int not null auto_increment, title varchar(255) not null, author varchar(55) not null, description text not null, date int(14) not null, tutorial mediumtext not null, view int not null, primary key (id), unique id (id) In the show_photoshop_tutorial.php, i used this // Fetch info of the tutorial $result = mysql_query("select * from photoshop_tutorial where id=$id"); while($row = mysql_fetch_array($result)) { // Format the date $postdate=date("d-m-Y",$row[date]); // Add 1 view to the view column $v = $row[view]; $vplus = $v+1; $view = mysql_query("update photoshop_tutorial where id=$id set view=$vplus"); // Problem here! // Fetch user's info from another table $user = mysql_query("select * from site_users where displayname = '$row[author]'"); $get_info = mysql_fetch_array($user); // Print out query results to the screen echo "$row[title]"; echo "Author: $get_info[displayname] on $postdate view "; echo "$row[description]"; echo "$row[tutorial]"; } But the view doedn't add 1 to the existing value Any solutions for that? Best regards, Le Hoang
Re: [PHP-DB] UPDATE doesn't work
On Wednesday 05 February 2003 12:50, Le Hoang wrote: > > // Add 1 view to the view column > > $v = $row[view]; > $vplus = $v+1; > $view = mysql_query("update photoshop_tutorial where id=$id set > view=$vplus"); // Problem here! You should ALWAYS check the result of a call to mysql_query(): if ($view === false) { echo "Fatal error: " . mysql_error(); } Your problem is that the SQL for update is incorrect and it should be: "UPDATE photoshop_tutorial SET view = $vplus WHERE id = $id" You can also do the increment inside the SQL so: "UPDATE photoshop_tutorial SET view = view + 1 WHERE id = $id" -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Tell a man there are 300 billion stars in the universe and he'll believe you. Tell him a bench has wet paint on it and he'll have to touch to be sure. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] inserting datas through table
Dear Sir/Madam, (B I have create table for reservation system in that table i need to save (Ball the values (Bbut it couldn`t save all the values it saves only the last value. (B Please help me! (B (B (B (BSetdate: (BFirst name: (BUserID: (BPassword: (B Confirm Password: (BDepartment: (B"); (Bwhile($myrow = mysql_fetch_array($result)) (B { (Bprintf("%s\n", (B$myrow["bumon"],$myrow["bumon"]); (B } (B?> (BE-mail: (B (B (Bhttp://192.168.1.22/test/Master1.php'"> (BMasterCheck (B (B (B (B
[PHP-DB] inserting datas through table
Dear Sir/Madam, (BI have created reservation table i need to store all the values in (Bdatabase when i click the submit button (Bbut it couldn`t working. (B/* (BMaster3.php (B*/ (B (B (B (B (B (B (B Month (B Day (B Time Zone (B Start Time (BDepartment (B (B (B (B (B (Bselect "); (Bwhile($myrow = mysql_fetch_array($result)) (B { (Bprintf("%s\n", (B$myrow["youbi"],$myrow["youbi"]); (B } (B?> (B (B (B (B (Bselect "); (Bwhile($myrow = mysql_fetch_array($result)) (B { (Bprintf("%s\n", (B$myrow["bumon"],$myrow["bumon"]); (B } (B?> (B (Bselect "); (Bwhile($myrow = mysql_fetch_array($result)) (B { (Bprintf("%s\n", (B$myrow["bumon"],$myrow["bumon"]); (B } (B?> (B (Bselect "); (Bwhile($myrow = mysql_fetch_array($result)) (B { (Bprintf("%s\n", (B$myrow["bumon"],$myrow["bumon"]); (B } (B?> (B (Bselect "); (Bwhile($myrow = mysql_fetch_array($result)) (B { (Bprintf("%s\n", (B$myrow["bumon"],$myrow["bumon"]); (B } (B?> (B (B (B (B (B (B (Bselect "); (Bwhile($myrow = mysql_fetch_array($result)) (B { (Bprintf("%s\n", (B$myrow["youbi"],$myrow["youbi"]); (B } (B?> (B (B (B (B (Bselect "); (Bwhile($myrow = mysql_fetch_array($result)) (B { (Bprintf("%s\n", (B$myrow["bumon"],$myrow["bumon"]); (B } (B?> (B (Bselect "); (Bwhile($myrow = mysql_fetch_array($result)) (B { (Bprintf("%s\n", (B$myrow["bumon"],$myrow["bumon"]); (B } (B?> (B (Bselect "); (Bwhile($myrow = mysql_fetch_array($result)) (B { (Bprintf("%s\n", (B$myrow["bumon"],$myrow["bumon"]); (B } (B?> (B (Bselect "); (Bwhile($myrow = mysql_fetch_array($result)) (B { (Bprintf("%s\n", (B$myrow["bumon"],$myrow["bumon"]); (B } (B?> (B (B (B (B (B (B (Bselect "); (Bwhile($myrow = mysql_fetch_array($result)) (B { (Bprintf("%s\n", (B$myrow["youbi"],$myrow["youbi"]); (B } (B?> (B (B (B (B (Bselect "); (Bwhile($myrow = mysql_fetch_array($result)) (B { (Bprintf("%s\n", (B$myrow["bumon"],$myrow["bumon"]); (B } (B?> (B (Bselect "); (Bwhile($myrow = mysql_fetch_array($result)) (B { (Bprintf("%s\n", (B$myrow["bumon"],$myrow["bumon"]); (B } (B?> (B (Bselect "); (Bwhile($myrow = mysql_fetch_array($result)) (B { (Bprintf("%s\n", (B$myrow["bumon"],$myrow["bumon"]); (B } (B?> (B (Bselect "); (Bwhile($myrow = mysql_fetch_array($result)) (B { (Bprintf("%s\n", (B$myrow["bumon"],$myrow["bumon"]); (B } (B?> (B (B (B (B (B (B (B (B
Re: [PHP-DB] inserting datas through table
On Wednesday 05 February 2003 15:03, kumar wrote: (B (B> I have created reservation table i need to store all the values in (B> database when i click the submit button (B> but it couldn`t working. (B (BCould you give a detailed description of HOW it isn't working? (B (BWhat did you expect the code to do? (B (BWhat is the code actually doing? (B (BDid you print out the key variables to see whether they contain what you (Bexpect them to contain? (B (B (B[snip] (B (B-- (BJason Wong -> Gremlins Associates -> www.gremlins.biz (BOpen Source Software Systems Integrators (B* Web Design & Hosting * Internet & Intranet Applications Development * (B-- (BSearch the list archives before you post (Bhttp://marc.theaimsgroup.com/?l=php-db (B-- (B/* (BQOTD: (B"Oh, no, no... I'm not beautiful. Just very, very pretty." (B*/ (B (B (B-- (BPHP Database Mailing List (http://www.php.net/) (BTo unsubscribe, visit: http://www.php.net/unsub.php