blufish Posted May 15, 2008 Share Posted May 15, 2008 theres an error on line 11 which I think is due to having to have 3 different kinds of quotation marks. when I remove one of them I get errors on lines 12 and 13 which I think are directly related to the line 11 problem. If you have any tips on how to fix this, please help me. <?php echo "<html><head><title>Account Creation...</title></head><body bgcolor='#cccccc' alink='black' vlink='gray' link='white'><b>"; $con = mysql_connect("www.frozenoven.com", "blufish_fart", "pants"); $finddb = mysql_select_db("blufish_frozenusers", $con); if(!$con || !$finddb) { die('Could not connect: ' . mysql_error()); } $_POST['name'] = addslashes(htmlspecialchars($_POST['name'])); $chex = mysql_query("SELECT * FROM 'users' WHERE 'name'="'. $_POST['name']."'"); $asdf = mysql_num_rows($chex); $array = mysql_fetch_array($chex); if ($array['cherk']=="" && $asdf != 1) { $sql = "INSERT INTO users (name,paas,cherk,wideone,widetwo,widethree,widefour,widefive,widesix,wideseven,wideeight,widenine,wideten) VALUES('$_POST[name]','$_POST[paas]','$_POST[name]'),'<!--None-->','<!--None-->','<!--None-->','<!--None-->','<!--None-->','<!--None-->','<!--None-->','<!--None-->','<!--None-->','<!--None-->')"; if (!mysql_query($sql,$con)) { die("<div style='text-align: center;'>Error: ". mysql_error() ."</div>"); } echo "<center>Account Created</center><BR><BR><p>To customize your page, please click <a href='customize.htm'>here</a>."; } else { echo 'Account name already in use.'; } mysql_close($con); ?> Link to comment https://forums.phpfreaks.com/topic/105703-having-some-troubles/ Share on other sites More sharing options...
MasterACE14 Posted May 15, 2008 Share Posted May 15, 2008 this line 11 ? $chex = mysql_query("SELECT * FROM 'users' WHERE 'name'="'. $_POST['name']."'"); change it to this... $chex = mysql_query("SELECT * FROM `users` WHERE `name`='". $_POST['name']."'"); Regards ACE Link to comment https://forums.phpfreaks.com/topic/105703-having-some-troubles/#findComment-541570 Share on other sites More sharing options...
blufish Posted May 15, 2008 Author Share Posted May 15, 2008 yes Link to comment https://forums.phpfreaks.com/topic/105703-having-some-troubles/#findComment-541572 Share on other sites More sharing options...
blufish Posted May 15, 2008 Author Share Posted May 15, 2008 I got this after changing what ACE told me to: Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''','','','','',' Link to comment https://forums.phpfreaks.com/topic/105703-having-some-troubles/#findComment-541575 Share on other sites More sharing options...
redarrow Posted May 15, 2008 Share Posted May 15, 2008 <?php //database connection..... // Thumb off rule, Never use $_post in a select statement............ $name=mysql_real_escape_string($_POST['name']); $sql="SELECT * FROM users WHERE name='$name'"; $sql_reult=mysql_query($sql)or die(mysql_error()); ?> Link to comment https://forums.phpfreaks.com/topic/105703-having-some-troubles/#findComment-541578 Share on other sites More sharing options...
blufish Posted May 15, 2008 Author Share Posted May 15, 2008 The code I'm currently using <?php echo "<html><head><title>Account Creation...</title></head><body bgcolor='#cccccc' alink='black' vlink='gray' link='white'><b>"; $con = mysql_connect("www.frozenoven.com", "blufish_fart", "pants"); $finddb = mysql_select_db("blufish_frozenusers", $con); if(!$con || !$finddb) { die('Could not connect: ' . mysql_error()); } $_POST['name'] = addslashes(htmlspecialchars($_POST['name'])); $name=mysql_real_escape_string($_POST['name']); $sql="SELECT * FROM users WHERE name='$name'"; $sql_reult=mysql_query($sql)or die(mysql_error()); $asdf = mysql_num_rows($chex); $array = mysql_fetch_array($chex); if ($array['cherk']=="" && $asdf != 1) { $sql = "INSERT INTO users ($name,paas,cherk,wideone,widetwo,widethree,widefour,widefive,widesix,wideseven,wideeight,widenine,wideten) VALUES('$_POST[name]','$_POST[paas]','$_POST[name]'),'<!--None-->','<!--None-->','<!--None-->','<!--None-->','<!--None-->','<!--None-->','<!--None-->','<!--None-->','<!--None-->','<!--None-->')"; if (!mysql_query($sql,$con)) { die("<div style='text-align: center;'>Error: ". mysql_error() ."</div>"); } echo "<center>Account Created</center><BR><BR><p>To customize your page, please click <a href='customize.htm'>here</a>."; } else { echo 'Account name already in use.'; } mysql_close($con); ?> Is giving me the following errors: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/blufish/public_html/test/signing.php on line 15 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/blufish/public_html/test/signing.php on line 16 Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''','','','','',' Any ideas? Link to comment https://forums.phpfreaks.com/topic/105703-having-some-troubles/#findComment-541585 Share on other sites More sharing options...
MasterACE14 Posted May 15, 2008 Share Posted May 15, 2008 $chex isn't previously set and there is a typo here... $sql_reult change to $sql_result Link to comment https://forums.phpfreaks.com/topic/105703-having-some-troubles/#findComment-541591 Share on other sites More sharing options...
redarrow Posted May 15, 2008 Share Posted May 15, 2008 why your insert got post in it ........... Link to comment https://forums.phpfreaks.com/topic/105703-having-some-troubles/#findComment-541595 Share on other sites More sharing options...
blufish Posted May 15, 2008 Author Share Posted May 15, 2008 I fixed the result problem but now I get these errors: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/blufish/public_html/test/signing.php on line 15 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/blufish/public_html/test/signing.php on line 16 Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''','','','','',' What do you mean by post thingy can you explain? I think you mean $_POST but I don't understand where is it and what is wrong? thanks Link to comment https://forums.phpfreaks.com/topic/105703-having-some-troubles/#findComment-541613 Share on other sites More sharing options...
redarrow Posted May 15, 2008 Share Posted May 15, 2008 the best way is to echo out the querys then see if the querys are correct.... $_post[name] << emaple is wrong it like this $_post['name'] Link to comment https://forums.phpfreaks.com/topic/105703-having-some-troubles/#findComment-541618 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.