View Single Post
Old 12-01-2007, 01:31 PM   #7 (permalink)
DragonBe
The Wanderer
PHP Guru Advanced Programmer Zend Certified 
 
DragonBe's Avatar
 
Join Date: Nov 2007
Location: according to my wife: on the Net
Posts: 19
Thanks: 0
DragonBe is on a distinguished road
Default

Hey Winsrev,

A simple example might show you where you might have done things wrong.

PHP Code:
if ($conn mysql_connect('hostname:port''username''password')) {
  if (
$db mysql_select_db('database'$conn)) {
    
$query mysql_query(sprintf("INSERT INTO `table` SET `field_a`='%s', `field_b`='%s'"$clean_field_a$clean_field_b), $conn);
    
$last_insert_id mysql_insert_id($conn); // returns last auto_incremented id
    
$affected_rows mysql_affected_rows($conn); // returns how many rows were affected
  
} else {
    
$error_db mysql_errno($conn) . ": " mysql_error($conn);
  }
} else {
  
$error_db_conn mysql_errno($conn) . ": " mysql_error($conn);

Hope this cleared some of your questions.

Good luck,

DragonBe
Send a message via ICQ to DragonBe Send a message via Skype™ to DragonBe
DragonBe is offline  
Reply With Quote