xcoderx Posted July 27, 2010 Share Posted July 27, 2010 people why is it that on my wamp script with mysqli do not want to run but only mysql does? Quote Link to comment https://forums.phpfreaks.com/topic/209000-mysqli-does-not-work-with-wamp/ Share on other sites More sharing options...
Philip Posted July 27, 2010 Share Posted July 27, 2010 Is it enabled in php.ini? Quote Link to comment https://forums.phpfreaks.com/topic/209000-mysqli-does-not-work-with-wamp/#findComment-1091659 Share on other sites More sharing options...
xcoderx Posted July 27, 2010 Author Share Posted July 27, 2010 oh we must enable it? am actualy new to mysqli i have nt tried it b4. could u guide me enable it plz. Quote Link to comment https://forums.phpfreaks.com/topic/209000-mysqli-does-not-work-with-wamp/#findComment-1091744 Share on other sites More sharing options...
Mchl Posted July 27, 2010 Share Posted July 27, 2010 Just like any other extension. If it's WampServer you're using, click on it's icon in tray, go to PHP > PHP Extensions and make sure there's a tick next to php_mysqli. If it's there already (by default it should) then there's something else wrong with what you're doing. Quote Link to comment https://forums.phpfreaks.com/topic/209000-mysqli-does-not-work-with-wamp/#findComment-1091779 Share on other sites More sharing options...
xcoderx Posted July 27, 2010 Author Share Posted July 27, 2010 i just checked bro there is a tick but why wont it run? Quote Link to comment https://forums.phpfreaks.com/topic/209000-mysqli-does-not-work-with-wamp/#findComment-1091788 Share on other sites More sharing options...
Mchl Posted July 27, 2010 Share Posted July 27, 2010 Any error messages? Quote Link to comment https://forums.phpfreaks.com/topic/209000-mysqli-does-not-work-with-wamp/#findComment-1091856 Share on other sites More sharing options...
xcoderx Posted July 28, 2010 Author Share Posted July 28, 2010 no error displays either. even my mysql errors do not want to show. Quote Link to comment https://forums.phpfreaks.com/topic/209000-mysqli-does-not-work-with-wamp/#findComment-1091991 Share on other sites More sharing options...
Mchl Posted July 28, 2010 Share Posted July 28, 2010 Show the code? Quote Link to comment https://forums.phpfreaks.com/topic/209000-mysqli-does-not-work-with-wamp/#findComment-1092033 Share on other sites More sharing options...
xcoderx Posted July 28, 2010 Author Share Posted July 28, 2010 here bro see <?php //check for required fields from the form if ((!$_POST["topic_owner"]) || (!$_POST["topic_title"]) || (!$_POST["post_text"])) { header("Location: addtopic.html"); exit; } //connect to server $mysqli = mysqli_connect("localhost", "root", "demo", "forums"); //create and issue the first query $add_topic = "INSERT INTO forum_topics (topic_title, topic_create_ time, topic_owner) VALUES ('".$_POST["topic_title"]."',now(), '".$_POST["topic_owner"]."')"; $add_topic_res = mysqli_query($mysqli, $add_topic_sql) or die(mysqli_error($mysqli)); //get the id of the last query $topic_id = mysqli_insert_id($mysqli); //create and issue the second query $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 = mysqli_query($mysqli, $add_post_sql) or die(mysqli_error($mysqli)); //close connection to mysqli mysqli_close($mysqli); //create nice message for user $display_block = "<P>The <strong>".$_POST["topic_title"]."</strong> topic has been created.</p>"; ?> <html> <head> <title>New Topic Added</title> </head> <body> <h1>New Topic Added</h1> <?php echo $display_block; ?> </body> </html> the mysql errors also wont show nomore i dunno whats up with my wamp. the mysqli is l=ticked aswell but this script wont work Quote Link to comment https://forums.phpfreaks.com/topic/209000-mysqli-does-not-work-with-wamp/#findComment-1092266 Share on other sites More sharing options...
Mchl Posted July 28, 2010 Share Posted July 28, 2010 Are you sure it's not just your first if() redirecting you you? Add a simple echo before mysqli_connect() and see if it gets displayed Quote Link to comment https://forums.phpfreaks.com/topic/209000-mysqli-does-not-work-with-wamp/#findComment-1092300 Share on other sites More sharing options...
xcoderx Posted July 28, 2010 Author Share Posted July 28, 2010 yes thats the only redirect bro. nd adding echo also not doin anythin but same old blank page Quote Link to comment https://forums.phpfreaks.com/topic/209000-mysqli-does-not-work-with-wamp/#findComment-1092336 Share on other sites More sharing options...
Philip Posted July 29, 2010 Share Posted July 29, 2010 Check your error logs, and check to make sure error reporting & displaying are on/set properly. Quote Link to comment https://forums.phpfreaks.com/topic/209000-mysqli-does-not-work-with-wamp/#findComment-1092405 Share on other sites More sharing options...
TeddyKiller Posted August 8, 2010 Share Posted August 8, 2010 Comment these lines at the start out if ((!$_POST["topic_owner"]) || (!$_POST["topic_title"]) || (!$_POST["post_text"])) { header("Location: addtopic.html"); exit; } And do as Mchl stated with the echo. If this works, but doesn't work when the above line is uncommented.. then theres your problem. If the echo does get displayed, then it might be that Mysqli is having issues somewhere... (Sorry for reviving old post, it hasn't been noted if the problem has been fixed) Quote Link to comment https://forums.phpfreaks.com/topic/209000-mysqli-does-not-work-with-wamp/#findComment-1096521 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.