Jump to content

Query not running but no errors...


The14thGOD

Recommended Posts

I have a page that updates a press release and it runs one query but not the other. No errors as far as the query goes (some 'undefined variables' in other parts of the script).

 

Here's the code:

<?php
$updateQuery = "UPDATE website AS w INNER JOIN preview AS p ON (w.uid = p.uid) SET w.navtitle=p.navtitle, w.title=p.title, w.keywords=p.keywords, w.description=p.description, w.url=p.url, w.body=p.body, w.the_date=p.the_date, w.status=p.status WHERE w.uid = '$_GET[uid]'";
	mysql_query($updateQuery);
	$updateQuery2 = "UPDATE preview SET draft='false' WHERE uid='$_GET[uid]'";
	mysql_query($updateQuery2);
	echo $updateQuery2;
	echo mysql_error();
	exit();
	header("Location: $_SERVER[php_SELF]?edit=true&uid=$_GET[uid]&edit_suc=true");
	exit(0);
?>

 

Query:

UPDATE preview SET draft='false' WHERE uid='5pjm94ap98'

 

I have no idea what it could be.

Any help is appreciated,

Justin

Link to comment
Share on other sites

$_GET[uid] needs to be $_GET['uid']

and you can't do that without concatenating... well, or using curly brackets, but anyway

 

$updateQuery2 = "UPDATE preview SET draft='false' WHERE uid='" . $_GET['uid'] . "'";

Didn't work, plus it works in all the other queries as is :/ that's the only reason I didn't try that method.

It makes no sense, not sure what else I can do.. oh and just so there's no question about it, I have verified that the 1st query works.

Link to comment
Share on other sites

Does die() stop the whole script?

Yes, and if there were something wrong with your query it should have shown your an error.

 

Now you're at the point where you have to go to the top (the very top) of the script and put

error_reporting(448191);
ini_set("display_errors","on");

Link to comment
Share on other sites

All the errors I get are normal from what I can tell:

 

 

Notice: import_request_variables() [function.import-request-variables]: No prefix specified - possible security hazard in /path/to/press.php on line 5

 

Notice: Undefined variable: date in /path/to/press.php on line 9

 

Notice: Undefined offset: 1 in /path/to/press.php on line 10

 

Notice: Undefined offset: 2 in /path/to/press.php on line 10

 

Notice: Undefined variable: send in /path/to/press.php on line 11

 

Notice: Undefined variable: edit in /vpath/to/press.php on line 44

Link to comment
Share on other sites

ok.... so or die() ceases to do it's job for some reason today??

 

lol I have no idea dude, this is so simple it's stupid, at first I was thinking it had something to do with me not looking at this for a while, but everyone is scratching their heads...

 

The new code didn't produce anything new, just went through like normal.

Link to comment
Share on other sites

$updateQuery2 = "UPDATE preview SET draft='false' WHERE uid='$_GET[uid]'";

 

There's no smiley for "graspping at straws" ...

 

What is the datatype for "draft"? Is it actually a char (or varchar) or is it a BOOLEAN.  Boolean is a INT(1) and you would need to set it to 0 (zero) or 1 (one).

Link to comment
Share on other sites

I was just thinking that if it was boolean, the update would fail trying to set it to a string.

 

Again, grasping at straws, is there some kind of protection issue with that table? When you ran the code in phpMyAdmin were you using the same login that your code is using?

 

Is there an UPDATE trigger on that table? or some other constraint?

 

Are you sure you are not falling into some other code that is setting it back to false? I guess that would be kind of hard since you have an exit() right after it.

 

I really do not see any reason that that code would not execute as expected. Is this your actual code? or did you leave out stuff that you think is not significant? (I'm just asking)

Link to comment
Share on other sites

I'm not sure how it logs in to phpmyadmin, this server is on visi, but this user has all permissions.

Not sure what an update trigger is on the table...I'd assume no, I don't typically mess with sql other than data inserting etc.

 

It's all the code that is triggered in the event it is 'published.' It's in an if statement, but it runs as testing has proved.

 

Double checked code and there's nothing else that could set it back to true without conditions are met (also tested to see if conditions were being set off on accident, and they were not)

 

Ya..I'm with everyone at the moment. No idea what could be going wrong...

Link to comment
Share on other sites

Well, just for grins, try reversing the two updates, run updatequery2 first then updatequery. See which one works.

 

Also, check all the server logs, Apache, MySql, and OS if you have access to them.

 

At this point, I would normally delete several lines of code and retype from memory, assuming there's something there I just can't see.

 

Sorry, I can't be more help.

Link to comment
Share on other sites

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.