RSS Forums RSS
Please support our PHP advertiser: Lunarpages PHP Web Hosting

writitng data from php to mysql

Join Date: Sep 2005
Posts: 716
Reputation: digital-ether has a spectacular aura about digital-ether has a spectacular aura about 
Rep Power: 6
Solved Threads: 44
Moderator
digital-ether's Avatar
digital-ether digital-ether is offline Offline
Master Poster

Re: writitng data from php to mysql

  #5  
Mar 16th, 2007
Try some error checking on the mysql query:

eg:

[php]
$result = mysql_query("INSERT INTO shoutbox (id,ip,name,url,message,date) VALUES('','$ip','$name','$url','$message','$date')") or die('Error inserting into DB.');

if ($result) {

// ok
echo "Mysql Insert ok";

} else {
echo "DB Error, could not query the database\n";
echo 'MySQL Error: ' . mysql_error();
exit;
}

[/php]

the mysql_query() will return false if the query fails, and the last error for your mysql session/connection will be returned by mysql_error()
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Reply With Quote  
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 2:53 pm.
Newsletter Archive - Sitemap - Privacy Statement - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC