Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mysql - Created new table OK but? 1

Status
Not open for further replies.

4x4uk

Technical User
Apr 30, 2002
381
GB
Please bear with we I,m new to using mysql. I created a table called stats in a database called mylandy, which already existed. However using the following php script nothing is written to the table. What am I doing wrong.
mysql version 3.23.49a, table created using mysqltool v.095
Code:
$db = mysql_connect("cdb-1.prv.ampira.com:3307" , "imcco" , "r990jcu");
mysql_select_db("mylandy", $db);
$sql = "INSERT INTO stats(ip,date,browser,referrer,request,cpu,screen,colour,javascript,cookies) VALUES ('$ip','$dtime','$agent','$ref','$svreq','$uspc','$ussd','$ussc','$usjs','$uscs')";
$results = mysql_query ($sql);

Thanks
Ian It's not a lie if you believe it!

 
What is the value of $result after you perform mysql_query()? If the query fails, $result will be false.

If $result is false, output the return of mysql_error(). It will tell you pretty explicitly what your error is.

I have a FAQ (faq434-2999) in this forum which has some example code for writing simple MySQL access code that produces good debugging information. Want the best answers? Ask the best questions: TANSTAAFL!
 
FYI:

I don't know if the connection information you're passing to your mysql_connect() function is real or not, but it looks suspiciously real to me.

When posting code, I recommend you replace the host, user, and password options with innocuous bogus data. Want the best answers? Ask the best questions: TANSTAAFL!
 
I recommend just changing them to "host", "user", "password".

Somebody might try to decode your mangling, and might just succeed. Although MySQL's user/password/IP authentication tuple will likely keep them out, someone might DOS you or use some security hole he knows about but you don't. Want the best answers? Ask the best questions: TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top