note 83579 added to function.mysql-query

From: Date: Mon, 02 Jun 2008 21:42:37 +0000
Subject: note 83579 added to function.mysql-query
Groups: php.notes 
Request: Send a blank email to php-notes+get-140073@lists.php.net to get a copy of this message
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>"; ?> ---- Server IP: 208.69.120.35 Probable Submitter: 208.65.3.133 ---- Manual Page -- http://www.php.net/manual/en/function.mysql-query.php Edit -- https://master.php.net/note/edit/83579 Del: integrated -- https://master.php.net/note/delete/83579/integrated Del: useless -- https://master.php.net/note/delete/83579/useless Del: bad code -- https://master.php.net/note/delete/83579/bad+code Del: spam -- https://master.php.net/note/delete/83579/spam Del: non-english -- https://master.php.net/note/delete/83579/non-english Del: in docs -- https://master.php.net/note/delete/83579/in+docs Del: other reasons-- https://master.php.net/note/delete/83579 Reject -- https://master.php.net/note/reject/83579 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#140073) next »