PHP Web Host - Quality Web Hosting For All PHP Applications Just Great Software
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
Donovan
Client


Joined: Oct 07, 2003
Posts: 735
Location: Ohio

PostPosted: Sat Dec 16, 2006 8:29 pm Reply with quote Back to top

I have been struggling with this for days. The correct values are displayed in the form. I am passing them with hidden fields.

Even though I don't think I need to.

But I can't get either one of these to write to the database. I need help.

I'll link a txt file.
Only registered users can see links on this board!
Get registered or login to the forums!
View user's profile Send private message Visit poster's website ICQ Number
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Sat Dec 16, 2006 10:32 pm Reply with quote Back to top

Change this line
$result = $db->sql_query ("INSERT INTO " . $prefix . "_eto_tracking (log_id, ateam_id, dteam_id, tid, move_dt, action)". "VALUES ('NULL','$ateam_id','$dteam_id','$tid',CURRENT_TIMESTAMP(),'$action')");

To
$sql = "INSERT INTO " . $prefix . "_eto_tracking (log_id, ateam_id, dteam_id, tid, move_dt, action) VALUES (NULL,'$ateam_id','$dteam_id','$tid',CURRENT_TIMESTAMP(),'$action')";
echo '$sql = '.$sql;
die();
$result = $db->sql_query ($sql);

See what $sql looks like and if it seems ok then run the $sql directly in phpmyadmin.
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Donovan
Client


Joined: Oct 07, 2003
Posts: 735
Location: Ohio

PostPosted: Sat Dec 16, 2006 10:53 pm Reply with quote Back to top

Here is what came back.

$sql = INSERT INTO nuke_eto_tracking (log_id, ateam_id, dteam_id, tid, move_dt, action) VALUES (NULL,'','','',CURRENT_TIMESTAMP(),'Attack')
View user's profile Send private message Visit poster's website ICQ Number
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Sat Dec 16, 2006 11:03 pm Reply with quote Back to top

I just noticed something? Where is your closing </form> statement Wink
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Donovan
Client


Joined: Oct 07, 2003
Posts: 735
Location: Ohio

PostPosted: Sat Dec 16, 2006 11:12 pm Reply with quote Back to top

&^%#!

That still didn't help, but good catch.
View user's profile Send private message Visit poster's website ICQ Number
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Sat Dec 16, 2006 11:20 pm Reply with quote Back to top

Have you verified that those variables that you want to write have values? It could be the SQL statement is correct but the $_POST values are empty. We need to isolate where it's happening before resolving what is happening.
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Donovan
Client


Joined: Oct 07, 2003
Posts: 735
Location: Ohio

PostPosted: Sat Dec 16, 2006 11:31 pm Reply with quote Back to top

I know the SQL is correct because the page displays the correct values.

Image

I don't think I need to pass the hidden values because they are not really hidden. I was trying to anyway.

Code:
echo"<input type=\"hidden\" name=\"ateam_id\" value=\"$ateam_id\">"
."<input type=\"hidden\" name=\"dteam_id\" value=\"$dteam_id\">"
."<input type=\"hidden\" name=\"tid\" value=\"$tid\">"


And Iv'e always written this way. I don't know how else to do it.

Code:
if ($op == "ConfirmAttack") {        
      $ateam_id = $_POST['team_id']; 
      $dteam_id = $_POST['dteam_id']; 
      $tid = $_POST['tid'];    
View user's profile Send private message Visit poster's website ICQ Number
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Sat Dec 16, 2006 11:57 pm Reply with quote Back to top

But, are there values here:

if ($op == "ConfirmAttack") {
$ateam_id = $_POST['team_id'];
$dteam_id = $_POST['dteam_id'];
$tid = $_POST['tid'];
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Donovan
Client


Joined: Oct 07, 2003
Posts: 735
Location: Ohio

PostPosted: Sun Dec 17, 2006 12:09 am Reply with quote Back to top

No. I've tried this and get nothing.

Code:

if ($op == "ConfirmAttack") {        
      $ateam_id = $_POST['team_id']; 
      $dteam_id = $_POST['dteam_id']; 
      $tid = $_POST['tid'];    
      $action = 'Attack';   

      echo $ateam_id;
      echo $dteam_id;
      echo $tid;
      die();
View user's profile Send private message Visit poster's website ICQ Number
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Sun Dec 17, 2006 12:14 am Reply with quote Back to top

So, we know that the problem is that the values aren't getting passed, not in the writing to the database. Please post your latest code in the TXT file, with the closing </form> statement.
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Donovan
Client


Joined: Oct 07, 2003
Posts: 735
Location: Ohio

PostPosted: Sun Dec 17, 2006 12:25 am Reply with quote Back to top

Done
View user's profile Send private message Visit poster's website ICQ Number
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Sun Dec 17, 2006 12:26 am Reply with quote Back to top

Right before this statement
echo"<input type=\"hidden\" name=\"ateam_id\" value=\"$ateam_id\">"

Check all the values. I believe you will find they are either empty or are equal to the LAST record you read, which is not what I think you are after.
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Donovan
Client


Joined: Oct 07, 2003
Posts: 735
Location: Ohio

PostPosted: Sun Dec 17, 2006 12:33 am Reply with quote Back to top

Outside the loop like this?

Closetable();
}

echo $ateam_id;
echo $dteam_id;
echo $tid;

echo"<input type=\"hidden\" name=\"ateam_id\" value=\"$ateam_id\">"
."<input type=\"hidden\" name=\"dteam_id\" value=\"$dteam_id\">"
."<input type=\"hidden\" name=\"tid\" value=\"$tid\">"
."<input type=\"hidden\" name=\"div_id\" value=\"$div_id\">"
."<input type=\"hidden\" name=\"op\" value=\"ConfirmAttack\">"
."</form>";
@include_once("footer.php");
View user's profile Send private message Visit poster's website ICQ Number
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Sun Dec 17, 2006 12:35 am Reply with quote Back to top

Yep
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Donovan
Client


Joined: Oct 07, 2003
Posts: 735
Location: Ohio

PostPosted: Sun Dec 17, 2006 12:41 am Reply with quote Back to top

It returns 14512748

145 is the id of $ateam_id

127 is the id of the last row in the query for $dteam_id and belong to the 2nd Armored Division

48 is the tid of the territory I'm on called Lincolnshire
View user's profile Send private message Visit poster's website ICQ Number
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Sun Dec 17, 2006 12:51 am Reply with quote Back to top

Are those the values you want to pass?
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Donovan
Client


Joined: Oct 07, 2003
Posts: 735
Location: Ohio

PostPosted: Sun Dec 17, 2006 12:59 am Reply with quote Back to top

The first and third one are, but the middle one being the dteam_id should depend on which one I click on. Look at the graphic about 9 posts up.
View user's profile Send private message Visit poster's website ICQ Number
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Sun Dec 17, 2006 1:05 am Reply with quote Back to top

Just try $_GET['op'] in place of $op to humor me Smile
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Donovan
Client


Joined: Oct 07, 2003
Posts: 735
Location: Ohio

PostPosted: Sun Dec 17, 2006 1:12 am Reply with quote Back to top

Nope. $action and CURRENT_TIMESTAMP() still get posted along with the $log_id but none of the other values.
View user's profile Send private message Visit poster's website ICQ Number
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Sun Dec 17, 2006 1:16 am Reply with quote Back to top

Just as an fyi, remove the quotes from around NULL. I've got to goto bed. It's something simple - I'm just too tired to look at it anymore. The print is all running together. I'll check back in the morning.
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Donovan
Client


Joined: Oct 07, 2003
Posts: 735
Location: Ohio

PostPosted: Sun Dec 17, 2006 1:19 am Reply with quote Back to top

Hitting the pillow myself. Thanks for your help.
View user's profile Send private message Visit poster's website ICQ Number
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Sun Dec 17, 2006 1:20 am Reply with quote Back to top

When you look at the source code for the page when you call it up, are the hidden values populated correctly?
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Donovan
Client


Joined: Oct 07, 2003
Posts: 735
Location: Ohio

PostPosted: Sun Dec 17, 2006 1:30 am Reply with quote Back to top

The are populated.

It looks right except for the dteam_id that's contained in the last dteam_id in the query

<input type="hidden" name="ateam_id" value="145">
<input type="hidden" name="dteam_id" value="127">
<input type="hidden" name="tid" value="48">
<input type="hidden" name="div_id" value="2">
<input type="hidden" name="op" value="ConfirmAttack">
</form>
View user's profile Send private message Visit poster's website ICQ Number
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Sun Dec 17, 2006 4:06 am Reply with quote Back to top

Please zip up and send me the page source. Thanks.
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Donovan
Client


Joined: Oct 07, 2003
Posts: 735
Location: Ohio

PostPosted: Sun Dec 17, 2006 11:24 am Reply with quote Back to top

You mean the db tables?
View user's profile Send private message Visit poster's website ICQ Number
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum