SunQuest
 
           General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old May 23rd, 2003, 03:32 PM
Mojoman's Avatar
Mojoman Mojoman is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: Washington, DC
Posts: 39 Mojoman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 34 m 34 sec
Reputation Power: 6
Disappearing $variables!

I'm attempting to create an "in-site" mail system using the following code (BTW - I am a three month newbie to programming and PHP). The sender's info is drawn from a cookie ($userCook) and the recipient's info is carried over via url ($sendmess). Both work until the submit button is pressed.

Code follows:

PHP Code:
<?php
// Get timestamp
$now =  date("g:ia D m/d/y");

    
// Include ezSQL in order to use it..
    
include_once "ez_sql.php";

// Get username from cookie
global $userCook;

// Get user info from users table and cache it..
$user $db->get_row("SELECT * FROM users WHERE username = '$userCook'");

// Get userId the 'primary_key' from users table
$memberID = ($user->userId);

    
// Get user info from users table and cache it..
    
$mailto $db->get_row("SELECT * FROM users WHERE username = '$sendmess'");

// Get userId the 'primary_key' from users table
$sendmessID = ($mailto->userId);

if(
$BeenSubmitted) {

if(
$sendplmail $db->query ("INSERT INTO messages VALUES ('null', '$memberID', '$sendmessID', '$now', '{$_POST['strMessHead']}', '{$_POST['strMessBod']}', '', '')")) 


?>



When the form is submitted, all info except the "$sendmessID" gets inserted into the db. Somehow that variable disappears! I know it has the value that I am expecting because I use it to echo the username onto the mail form.

ARRRG! What Gives!?!?

- TIA!
__________________
$mybrain = "mush";
-------------------------------------------
http://www.loftsboston.com
http://www.gregdawsondesign.com

Last edited by Mojoman : May 24th, 2003 at 01:38 PM.

Reply With Quote
  #2  
Old May 24th, 2003, 04:36 PM
iahmed iahmed is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2003
Location: USA
Posts: 171 iahmed User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 42 m 58 sec
Reputation Power: 6
Your script looks like bug free (except maybe the lurking one ).
Anyway, plz try

include "ez_sql.php";

instead of current: include_once "ez_sql.php";

Any luck?

Reply With Quote
  #3  
Old May 25th, 2003, 11:18 AM
nicat23's Avatar
nicat23 nicat23 is offline
Addicted to Chaos..
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: Ft. Worth, TX
Posts: 653 nicat23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 47 m 52 sec
Reputation Power: 0
Send a message via AIM to nicat23 Send a message via Yahoo to nicat23
use require_once("ez_sql.php");


Also, one suggestion
try echoing the value of $sendmessID before you put it into the database..
ie
PHP Code:
 $sendmessID = ($mailto->userId);
echo 
"$sendmessID\n\n";
//other code goes below this.. 


if the value is blank then you may want to look at your $mailto array and make sure that it has all of the propper values in it.. it may be coming up blank, and if it is then that could be causing that problem..

Reply With Quote
  #4  
Old May 26th, 2003, 05:00 PM
Mojoman's Avatar
Mojoman Mojoman is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: Washington, DC
Posts: 39 Mojoman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 34 m 34 sec
Reputation Power: 6
Thanks for the suggestions - but none of them seem to work! I even tried swapping the 'memberID' with the 'sendmessID' - and still the sendmessID dissappears (while the memberID still works)! So I know there is nothing wrong with my query...

...ARRRG!

I hate work-arounds, but I think I am going to try and create the db record to include the memberID and the sendmessID first when the form page is called and then UPDATE the record with the form info.

I'd still welcome any suggestions to my quandry!

Reply With Quote
  #5  
Old May 26th, 2003, 05:12 PM
nicat23's Avatar
nicat23 nicat23 is offline
Addicted to Chaos..
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: Ft. Worth, TX
Posts: 653 nicat23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 47 m 52 sec
Reputation Power: 0
Send a message via AIM to nicat23 Send a message via Yahoo to nicat23
were those values blank?

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Disappearing $variables!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway