Jump to content

[SOLVED] Query Problem


Hartley

Recommended Posts

This is a segment of a larger script (the actual query involves a total of 43 columns, but I didn't post the whole thing for the sake of space. There is no error in the query, it just doesn't seem to pull.

 

<?php

$dbhosta = 'xxx';
$dbusera = 'xxx';
$dbpassa = 'xxx';
$dbnamea = 'xxx';

$conna = mysql_connect($dbhosta, $dbusera, $dbpassa) or die ('Error connecting to mysql');
mysql_select_db($dbnamea);

$attune = "SELECT cot_intro, arc_key_quest FROM attunement WHERE userid = " .$_COOKIE['bbuserid'];
$attquery = mysql_query($attune);

while($att = mysql_fetch_assoc($attquery))
{
   $cot_intro = $att['cot_intro'];
   $arc_key_quest = $att['arc_key_quest'];

}

if ($cot_intro == "1") {

$cot_intro_1 = "on";
$cot_intro_2 = "off";

}

else {

$cot_intro_1 = "off";
$cot_intro_2 = "on";

}


if ($arc_key_quest == "1") {

$arc_key_quest_1 = "on";
$arc_key_quest_2 = "off";

}

else {

$arc_key_quest_1 = "off";
$arc_key_quest_2 = "on";

}

?>

 

It's not a cookie problem, because even when I give a specific row to pull, it doesn't work. Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/59362-solved-query-problem/
Share on other sites

I forgot to include the mysql_error()! When I did it, I got more details:

 

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 'ssl, cot_mh FROM attunement WHERE userid = 1' at line 1

 

It was a part I cut out of the code snippet I posted. When I took out the ssl and cot_mh, it worked! However, I can't figure out why it did.

Link to comment
https://forums.phpfreaks.com/topic/59362-solved-query-problem/#findComment-294900
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.