For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > May 2004 > Re: [PHP-DB] Newbie inserting into a database









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PHP-DB] Newbie inserting into a database
Daniel Clark

2004-05-14, 4:30 pm

Remove the single quotes or change to double quotes around the variables.

> Here is what I have so far?
> <?
> $DBname = "testdatabase";
> $host = "localhost";
> $user = "root";
> $password = "password";
>
>
> $dbconnect = @mysql_connect('$host','$user','$passwor
d','$DBname');
>
> I know this is wrong since I am not connecting.
>
> What I want to do is INSERT several values into a database. What am I
> doing
> wrong and what do I need to do after I connect (The Code)? 7 day old
> problem here and pulling at my hair! Appreciate it!

Daniel Clark

2004-05-14, 4:30 pm

Remove the single quotes or change to double quotes around the variables.
(in the mysql_connect() statement)


> Here is what I have so far?
> <?
> $DBname = "testdatabase";
> $host = "localhost";
> $user = "root";
> $password = "password";
>
>
> $dbconnect = @mysql_connect('$host','$user','$passwor
d','$DBname');
>
> I know this is wrong since I am not connecting.
>
> What I want to do is INSERT several values into a database. What am I
> doing
> wrong and what do I need to do after I connect (The Code)? 7 day old
> problem here and pulling at my hair! Appreciate it!

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com