Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

mysql_query()

Codes here !

Moderators: macek, egami, gesf

mysql_query()

Postby strix » Sat Feb 08, 2003 2:42 am

I only started learning PHP and mySQL yesterday... so forgiveme for being so stupid...

But... i call this line in my PHP code

mysql_query("INSERT INTO requests (Artist,Title) VALUES ($Artist,$Title);");

and it doesn't insert it into the db...

but if i add things directly (ie using mysql.exe) i can get them to show when i run my code

Can any one help
strix
New php-forum User
New php-forum User
 
Posts: 2
Joined: Sat Feb 08, 2003 2:35 am

Postby pootergeist » Sat Feb 08, 2003 7:27 am

try ....

mysql_query("INSERT INTO `requests` (Artist,Title) VALUES ('$Artist','$Title')");

note: $Artist / $Title / Artist / Title and requests all need to be case sensitive correct.

subnote: if mysql breaks, just add
echo mysql_error();
after the query line to get some hints of what is wrong.
pootergeist
New php-forum User
New php-forum User
 
Posts: 191
Joined: Wed Jan 29, 2003 7:11 am
Location: UK

Postby strix » Sat Feb 08, 2003 8:00 am

Thanx for your help

echo mysql_error();
was useful.

For some reason it works like this...

mysql_query("INSERT INTO requests(Artist,Title) VALUES ('$Artist','$Title');");
strix
New php-forum User
New php-forum User
 
Posts: 2
Joined: Sat Feb 08, 2003 2:35 am


Return to mySQL & php coding

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron