runnerjp Posted November 18, 2006 Share Posted November 18, 2006 i keep getting the error couldent exicute quiery[code]<?// if ($looking == "guess") $looking = "guess";// elseif ($looking == "Just friends") $looking = "friends";// elseif ($looking == "Friends, maybe more") $looking = "maybe";// elseif ($looking == "Dating") $looking = "dating";// elseif ($looking == "Relationship") $looking = "relationship";// elseif ($looking == "Physical encounter") $looking = "physical";$table_name = "$tbl_profile";$connection = @mysql_connect("$db_host", "$db_user", "$db_pass") or die("Couldn't connect.");$db = @mysql_select_db($db_name, $connection) or die("Couldn't select database.");$sql = "UPDATE $table_nameSETpage_title= \"$page_title\",template= \"$template\",about_me= \"$about_me\",hobbies= \"$hobbies\",dob_mo= \"$dob_mo\",dob_day= \"$dob_day\",dob_yr= \"$dob_yr\",rate= \"$rate\",eye_color= \"$eye_color\",hair_color= \"$hair_color\",height_ft=\"$height_ft\",height_in= \"$height_in\",build= \"$build\",// orientation= \"$orientation\",// smoker= \"$smoker\",// relationship= \"$relationship\",// drinker= \"$drinker\",// drugs= \"$drugs\",// personality=\"$personality\",// looking= \"$looking\",gender= \"$gender\"WHERE profile_id=$profile";$result = @mysql_query($sql,$connection) or die("Couldn't execute query.");?>[/code]i know i havwe set it to do that if it goes wrong but why is it going wrongis it due to the @ on $result = @mysql_query($sql,$connection)?? Quote Link to comment https://forums.phpfreaks.com/topic/27679-what-have-i-done-wrong/ Share on other sites More sharing options...
Adika Posted November 18, 2006 Share Posted November 18, 2006 Try deleting the $connection from $result:$result = @mysql_query($sql) or die("Couldn't execute query."); Quote Link to comment https://forums.phpfreaks.com/topic/27679-what-have-i-done-wrong/#findComment-126598 Share on other sites More sharing options...
runnerjp Posted November 18, 2006 Author Share Posted November 18, 2006 nope still doing it Quote Link to comment https://forums.phpfreaks.com/topic/27679-what-have-i-done-wrong/#findComment-126599 Share on other sites More sharing options...
wildteen88 Posted November 18, 2006 Share Posted November 18, 2006 Remove the @ from infront of the mysql_query function. If you do that then you are hiding the error which will help you understand why you query is failing.Also add the mysql_error function in your die statement this will then show the error message from MySQL. So this is what you line of code should be:[code]$result = mysql_query($sql) or die("Couldn't execute query. <br /><pre>" . $sql . "</pre><br /><br />" . mysql_error());[/code]Post back what error(s) you get in full here. Quote Link to comment https://forums.phpfreaks.com/topic/27679-what-have-i-done-wrong/#findComment-126600 Share on other sites More sharing options...
runnerjp Posted November 18, 2006 Author Share Posted November 18, 2006 nice 1 i found it out useing that...i had tryed to send information to my database that i had deleted from the database so their was nothing to editso if i add [nobbc]<br /><pre>" . $sql . "</pre><br /><br />" . mysql_error());[/nobbc] to a query i will find out whats up yes?? Quote Link to comment https://forums.phpfreaks.com/topic/27679-what-have-i-done-wrong/#findComment-126606 Share on other sites More sharing options...
wildteen88 Posted November 18, 2006 Share Posted November 18, 2006 Only the mysql_error() part of it yesI added in [nobbc]<br /><pre>" . $sql . "</pre>[/nobbc] to the die statament so I can see what the query looked like if you did get an error. You can echo out your sql query too if you want. its up to you.You should only do this when your developing your script. When you go live you should remove bits of code that exposes your query for security reasons. Quote Link to comment https://forums.phpfreaks.com/topic/27679-what-have-i-done-wrong/#findComment-126608 Share on other sites More sharing options...
runnerjp Posted November 18, 2006 Author Share Posted November 18, 2006 sweet thanks for thati always like to know why some 1 did what they did when they help me otherwise if i get same mistake i will have to ask rather then do it myself lol too many ppl take the help and yet cant be botherd to understand why they did itthanks loads Quote Link to comment https://forums.phpfreaks.com/topic/27679-what-have-i-done-wrong/#findComment-126609 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.