Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Register Global Problem as well

Status
Not open for further replies.

overyde

Programmer
May 27, 2003
226
ZA
Hi,
I need to code this with register globals off but as far as I can see this is correct?!??!?


It comes up with this 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 '' at line 1

This is the code:

<?
session_start();

$hostname_db = &quot;localhost&quot;;
$database_db = &quot;imperial&quot;;
$username_db = &quot;&quot;;
$password_db = &quot;&quot;;
$db = mysql_pconnect($hostname_db, $username_db, $password_db) or die(mysql_error());
mysql_select_db($database_db, $db);

if ((!$_POST[vote]) || (!$_POST[mvote]) || (!$_POST[qvote]) || (!$_POST[amvote]) || (!$_POST[afvote])) {
header(&quot;Location: view.php?lnk=$id&quot;);
exit;
}

$sql_vote2=&quot;UPDATE place SET svotes$vote=svotes$vote+1, mvotes$mvote=mvotes$mvote+1, qvotes$qvote=qvotes$qvote+1, amvotes$amvote=amvotes$amvote+1, afvotes$afvote=afvotes$afvote+1 WHERE id=$id&quot;;


$res_vote2=mysql_query($sql_vote2) or die(mysql_error());



$url=$ref[0];
header(&quot;Location: view2.php?lnk=$id&quot;);

?>



Reality is built on a foundation of dreams.
 
Almost certainly not.

When building your query, you're using a group of variables that look to me as though they are depending on register_globals being set to &quot;on&quot;.

But why take my work for it? What does your query look like?



Want the best answers? Ask the best questions: TANSTAAFL!!
 
I see that now!
How do I recode it so that it works. All my tutorials here seem to have the register_globals set to on.

Will session varibles work?
help, help, help!!!

It took me ages to get this to work and now it is absolutely useless.

Reality is built on a foundation of dreams.
 
I should learn to relax and analyse the problem more.
I have sorted it out now. Used session_variables instead and works perfect [thumbsup2]

Now to set my cookies.

Reality is built on a foundation of dreams.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top