MySQL Forums
Forum List  »  PHP

Re: html,mysql,php copy data from one db to another
Posted by: Barry Galbraith
Date: June 14, 2012 05:47PM

To see what query you are actually building, and catch any error, you need to adopt something like this.

$sql = "SELECT * from mytable where id=$id";

echo $sql."<br>";  // this will show the built string

$result = mysql_query($sql) or die(mysql_error()); //this will show any errors.

When it all works, just comment out the echo line.

Building and executing the sql in one go, and not checking for errors is a disaster waiting to happen.

Good luck,
Barry.

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.