Re: [PHP] Select record by ID

2007-01-31 Thread Richard Lynch
On Tue, January 30, 2007 4:14 pm, nitrox . wrote: Richard, ive included your suggested code and now my php script is working properly. But I dont want to be a php copy/paste newb who has no clue of how things are working. If its not too much would you (or anybody) give a brief explanation

Re: [PHP] Select record by ID

2007-01-31 Thread Richard Lynch
On Tue, January 30, 2007 7:23 pm, Craige Leeder wrote: atleast this part: $user_id = mysql_real_escape_string((int) $_GET['user_id']); I'm not sure who put this in there, but you don't need to use mysql_real_escape_string() on that value if you're type casting it. If you are forcing it to be

Re: [PHP] Select record by ID

2007-01-30 Thread nitrox .
Thanks to all who have replied. As you probably have noticed im a total novice to php who is trying to achieve big things. Richard, ive included your suggested code and now my php script is working properly. But I dont want to be a php copy/paste newb who has no clue of how things are

Re: [PHP] Select record by ID

2007-01-30 Thread Paul Novitski
At 1/30/2007 02:14 PM, nitrox . wrote: If its not too much would you (or anybody) give a brief explanation of what this code is doing? Or are there any tutorials online that I can read that will educate me on this? Thanks again to all for your replies. Ive saved them all for future reference.

Re: [PHP] Select record by ID

2007-01-30 Thread Craige Leeder
atleast this part: $user_id = mysql_real_escape_string((int) $_GET['user_id']); I'm not sure who put this in there, but you don't need to use mysql_real_escape_string() on that value if you're type casting it. If you are forcing it to be an integer, there is nothing to escape. Integers are

Re: [PHP] Select record by ID

2007-01-29 Thread Robert Cummings
On Sun, 2007-01-28 at 21:12 -0500, Craige Leeder wrote: As someone else already stated, my best guess according to that error is that $user_id has a null, or inappropriate value. The error occurs at the last character of the query, so it has to be something like hat. Echo the query and let us

Re: [PHP] Select record by ID

2007-01-29 Thread Richard Lynch
On Sun, January 28, 2007 5:21 pm, nitrox . wrote: Im trying to display one record at a time by ID. Well im getting a blank page. Ive looked over my code and tried 20 different ways to get it to work to no avail. So any pointers on what Im doing wrong would be great. here is the code im

Re: [PHP] Select record by ID

2007-01-29 Thread Richard Lynch
January 28, 2007 6:20 pm, Larry Garfield wrote: On Sunday 28 January 2007 5:54 pm, Francisco M. Marzoa Alonso wrote: On dom, 2007-01-28 at 18:51 -0500, nitrox . wrote: I took the quotes off. I thought that quotes around numbers was wrong also. Quotes are no necessary around numeric

Re: [PHP] Select record by ID

2007-01-29 Thread Richard Lynch
On Sun, January 28, 2007 6:20 pm, Larry Garfield wrote: On Sunday 28 January 2007 5:54 pm, Francisco M. Marzoa Alonso wrote: On dom, 2007-01-28 at 18:51 -0500, nitrox . wrote: I took the quotes off. I thought that quotes around numbers was wrong also. Quotes are no necessary around

Re: [PHP] Select record by ID

2007-01-29 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-29 17:54:03 -0600: MySQL is the *only* db engine that lets you get away with [bleep] like apostrophes around numbers. Actually, these are examples of valid SQL: INTEGER '1', FLOAT '13.5'. test=# select version();

Re: [PHP] Select record by ID

2007-01-29 Thread Richard Lynch
On Mon, January 29, 2007 6:55 pm, Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2007-01-29 17:54:03 -0600: MySQL is the *only* db engine that lets you get away with [bleep] like apostrophes around numbers. Actually, these are examples of valid SQL: INTEGER '1', FLOAT '13.5'. test=# select

Re: [PHP] Select record by ID

2007-01-29 Thread Larry Garfield
On Monday 29 January 2007 7:19 pm, Richard Lynch wrote: Looks like PostgreSQL caved in to the unwashed masses of MySQL users who couldn't handle not putting apostrophes around everything to me... [sigh] :-) :-) :-) Oh well. I personally would prefer that the DB not accept bogus input

Re: [PHP] Select record by ID

2007-01-29 Thread Richard Lynch
On Mon, January 29, 2007 7:43 pm, Larry Garfield wrote: On Monday 29 January 2007 7:19 pm, Richard Lynch wrote: Looks like PostgreSQL caved in to the unwashed masses of MySQL users who couldn't handle not putting apostrophes around everything to me... [sigh] :-) :-) :-) Oh well. I

[PHP] Select record by ID

2007-01-28 Thread nitrox .
Before I ask my next question I just wanted to thank you all for being in this mailing community and sharing your knowledge. Its communitys like this that make life easier for all of us. Ok enough with the mushy stuff Im trying to display one record at a time by ID. Well im getting a blank

Re: [PHP] Select record by ID

2007-01-28 Thread Francisco M. Marzoa Alonso
The first thing that I probably do is to check for possible errors from DB: $result = mysql_query(SELECT * FROM inf_member WHERE user_id='$user_id' ); if ( ! $result ) { die (Could not perform query $query: .mysql_error().\n); } Regards, On dom,

Re: [PHP] Select record by ID

2007-01-28 Thread nitrox .
I took the quotes off. I thought that quotes around numbers was wrong also. I added the error checking and this is the error: Could not perform query : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at

Re: [PHP] Select record by ID

2007-01-28 Thread Francisco M. Marzoa Alonso
Ops!, Better this one: $query = SELECT inf_member WHERE user_id='$user_id' ; $result = mysql_query($query); if ( ! $result ) { die (Could not perform query $query: .mysql_error().\n); } I did copy and paste from my own code and you've not $query

Re: [PHP] Select record by ID

2007-01-28 Thread Paul Novitski
At 1/28/2007 03:21 PM, nitrox . wrote: Im trying to display one record at a time by ID. Well im getting a blank page. Ive looked over my code and tried 20 different ways to get it to work to no avail. So any pointers on what Im doing wrong would be great. here is the code im working with so

Re: [PHP] Select record by ID

2007-01-28 Thread Francisco M. Marzoa Alonso
On dom, 2007-01-28 at 18:51 -0500, nitrox . wrote: I took the quotes off. I thought that quotes around numbers was wrong also. Quotes are no necessary around numeric values, but they aren't wrong neither, simply optional. I added the error checking and this is the error: Could not perform

Re: [PHP] Select record by ID

2007-01-28 Thread Larry Garfield
On Sunday 28 January 2007 5:54 pm, Francisco M. Marzoa Alonso wrote: On dom, 2007-01-28 at 18:51 -0500, nitrox . wrote: I took the quotes off. I thought that quotes around numbers was wrong also. Quotes are no necessary around numeric values, but they aren't wrong neither, simply optional.

Re: [PHP] Select record by ID

2007-01-28 Thread Francisco M. Marzoa Alonso
On dom, 2007-01-28 at 18:20 -0600, Larry Garfield wrote: On Sunday 28 January 2007 5:54 pm, Francisco M. Marzoa Alonso wrote: On dom, 2007-01-28 at 18:51 -0500, nitrox . wrote: I took the quotes off. I thought that quotes around numbers was wrong also. Quotes are no necessary around

Re: [PHP] Select record by ID

2007-01-28 Thread Craige Leeder
As someone else already stated, my best guess according to that error is that $user_id has a null, or inappropriate value. The error occurs at the last character of the query, so it has to be something like hat. Echo the query and let us know what it outputs. - Craige On 1/28/07, Francisco M.