Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,471
There are 1093 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

MySQL Syntax error

Thread title: MySQL Syntax error
Closed Thread    
    Thread tools Search this thread Display Modes  
12-17-2006, 12:05 PM
#1
Alex Eyre is offline Alex Eyre
Alex Eyre's Avatar
Status: Designer
Join date: Aug 2006
Location: Manchester
Expertise:
Software:
 
Posts: 1,132
iTrader: 5 / 100%
 

Alex Eyre is on a distinguished road

Send a message via MSN to Alex Eyre

  Old  MySQL Syntax error

Hey everyone, I am creating a system for my new automated coding shop, please can you assist me with this. I am trying to take out the percent completion of there project from the table 'data'. I am using this syntax:

Originally Posted by COMMAND
SELECT * FROM data complete WHERE email = {$_SESSION['email']}
but I am currently getting this error:
Originally Posted by MYSQL server
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 '@hotmail.co.uk' at line 1
please advise me on my SQL syntax or any errors you see,
Regards, Alex.

12-17-2006, 12:20 PM
#2
Alex Eyre is offline Alex Eyre
Alex Eyre's Avatar
Status: Designer
Join date: Aug 2006
Location: Manchester
Expertise:
Software:
 
Posts: 1,132
iTrader: 5 / 100%
 

Alex Eyre is on a distinguished road

Send a message via MSN to Alex Eyre

  Old

Have fixed this myself, Mods please delete thread.
Alex.

12-17-2006, 02:25 PM
#3
Jeff Andersen is offline Jeff Andersen
Status: Superstar
Join date: Apr 2005
Location:
Expertise:
Software:
 
Posts: 4,449
iTrader: 10 / 100%
 

Jeff Andersen is on a distinguished road

  Old

Could you post your solution so that it can be here for the reference of other members?

12-17-2006, 02:31 PM
#4
Alex Eyre is offline Alex Eyre
Alex Eyre's Avatar
Status: Designer
Join date: Aug 2006
Location: Manchester
Expertise:
Software:
 
Posts: 1,132
iTrader: 5 / 100%
 

Alex Eyre is on a distinguished road

Send a message via MSN to Alex Eyre

  Old

sure, the problem was not with the syntax as I had thought, it was with the PHP code itself, I now know that you need to add a while statement to make it work, so the PHP ended up like this:


$sql = "SELECT complete, proj FROM `data` WHERE email ='{$_SESSION['email']}' ";
$result = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_array($result)){
Above, the superglobal 'result' will later be used in the script to define data taken from the mysql, like this, which will show 'proj' column from the respective row.


$row["proj"]
Hope this helps!
Alex.

12-17-2006, 02:51 PM
#5
Jeff Andersen is offline Jeff Andersen
Status: Superstar
Join date: Apr 2005
Location:
Expertise:
Software:
 
Posts: 4,449
iTrader: 10 / 100%
 

Jeff Andersen is on a distinguished road

  Old

Great, thanks for sharing. Should help someone else out if they come across something similar.

12-17-2006, 02:53 PM
#6
Alex Eyre is offline Alex Eyre
Alex Eyre's Avatar
Status: Designer
Join date: Aug 2006
Location: Manchester
Expertise:
Software:
 
Posts: 1,132
iTrader: 5 / 100%
 

Alex Eyre is on a distinguished road

Send a message via MSN to Alex Eyre

  Old

whoops, i put it in wrong, anyway updated and no problems
Alex.

Closed Thread    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed