[GLLUG] Retrieving a row from mysql

Matt Shirilla mshirilla at micim.com
Mon Feb 16 15:43:11 EST 2004

I am totally new to php but I thought it would help me to try to help you.
I think you add single quotes around $accnum.
$accnumwith  ---->   '$accnum'
-----Original Message-----
From: Seth Bembeneck [mailto:sbdataspiller at sbcglobal.net]
Sent: Monday, February 16, 2004 3:19 PM
Subject: [GLLUG] Retrieving a row from mysql

I'm working on my database project (See 'MySql: Database inside of a
It was suggested that I have an account number in each table...
So now for example my table is
(The real table has a lot more info, but hopefully this demonstrates what
I'm trying to do)
Table name: players
name - accountnum - blah -blah
Seth   -- 12              -- y      - n
You   --- 34             --- y     -k
Blah - N                -- more -- no
I have a query like this in php:
$name = 'Seth';
$accnum= 12;
$tablename = 'players'
query = mysql_query("SELECT * FROM $tablename WHERE name= '$name' AND
accountnum= $accnum");
When I run this, I get a message saying that I have an error in my syntext
and to check the manuel for my version of MySql for the right syntext to use
near " at line 1.
I specified accountnum in the table creation script as
accountnum int(10) unsigned NOT NULL
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.egr.msu.edu/mailman-archives/linux-user/attachments/20040216/6673df39/attachment.htm

More information about the linux-user mailing list