Re: Having trouble with this SQL query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> First of all, I'm a newbie to PHP and MYSQL and started working on a
> create table query in PHP to execute on MYSQL.  Can someone take a quick
> look at the following code to see if there are any problems?  Can you
> also advise some tips on debugging?

Print out your SQL queries when debugging. Make sure they look correct. (Not
an issue in your case, though, since you're not inserting any variables into
the SQL.)

Also, use mysql_error() in conjunction with mysql_query().

$rs = msyql_query($sql) or die(mysql_error());

or example. Wrapping your sql queries in a simple abstraction layer will
make debugging easier, too. You could use a simple db_query($sql) function
call and have error checking built into the function and handle all queries
the same.

---John Holmes...


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux