Jump to content

Recommended Posts

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_name

SET

page_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 wrong

is it due to the @ on $result = @mysql_query($sql,$connection)??
Link to comment
https://forums.phpfreaks.com/topic/27679-what-have-i-done-wrong/
Share on other sites

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.
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 edit

so if i add  [nobbc]<br /><pre>" . $sql . "</pre><br /><br />" . mysql_error());[/nobbc] to a query i will find out whats up yes??
Only the mysql_error() part of it yes

I 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.
sweet thanks for that
i 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 it

thanks loads
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.