note 83579 rejected from function.mysql-query by mgf

From: Date: Thu, 12 Jun 2008 10:32:20 +0000
Subject: note 83579 rejected from function.mysql-query by mgf
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-140369@lists.php.net to get a copy of this message
Note Submitter: yukisho ---- Just trying to figure out why I am getting an error. I get this error. Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/content/y/u/k/yukisho/html/test/addtopic.php on line 14 <? if ((!$_POST["topic_owner"]) || (!$_POST["topic_title"]) || (!$_POST["post_text"])) { header("Location: newtopic.php"); exit; } $mysql = mysql_connect("localhost", "user1", "pass2", "user3"); $add_topic_sql = "INSERT INTO forum_topics (topic_title, topic_create_ time, topic_owner) VALUES ('".$_POST["topic_title"]."',now(), '".$_POST["topic_owner"]."')"; $add_topic_res = mysql_query($mysql, $add_topic_sql) or die(mysql_error($mysql)); $topic_id = mysql_insert_id($mysql); $add_post_sql = "INSERT INTO forum_posts (topic_id,post_text, post_create_time, post_owner) VALUES ('".$topic_id."', '".$_POST["post_text"]."', now(), '".$_POST["topic_owner"]."')"; $add_post_res = mysql_query($mysql, $add_post_sql) or die(mysql_error($mysql)); mysql_close($mysql); $display_block = "<P>The <strong>".$_POST["topic_title"]."</strong> topic has been created.</p>"; ?>

« previous php.notes (#140369) next »