mysql_query()

Codes here !

Moderators: macek, egami, gesf

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

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

User avatar
pootergeist
New php-forum User
New php-forum User
Posts: 191
Joined: Wed Jan 29, 2003 7:11 am
Location: UK
Contact:

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.

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

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');");


Return to “mySQL & php coding”

Who is online

Users browsing this forum: No registered users and 1 guest

cron