For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > October 2007 > Re: [PHP-DB] basic form entry









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] basic form entry
OKi98

2007-10-08, 8:02 am

most likely you have a problem in your query but you dont understand how
to use mysql_error.

from http://www.php.net/manual/en/function.mysql-error.php :
string *mysql_error* ( [resource $link_identifier] )

Returns the error text from the last MySQL function

> echo mysql_error(mysql_connect($host,$usernam
e,$psswd));
>

you see now? you are creating new connection. correct code should appear
similar to this:

$connection=mysql_connect($host,$usernam
e,$psswd) or die ("errror in access db");
mysql_select_db($db,$connection);
if (!mysql_query ("INSERT INTO users (First,Last,Phone,Mobile,Email,Web) VALUES
('$first_name','$last','$phone,'$mobile'
,'$email','$web') ",$connection)) echo("error ".mysql_error($connection));
Sponsored Links







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

Copyright 2008 codecomments.com