Current location: Hot Scripts Forums » Programming Languages » PHP » why is this not inserting?


why is this not inserting?

Reply
  #1 (permalink)  
Old 02-04-04, 12:45 AM
simone's Avatar
simone simone is offline
Newbie Coder
 
Join Date: Nov 2003
Posts: 67
Thanks: 0
Thanked 0 Times in 0 Posts
why is this not inserting?

ok this is real annoying, and dont see any logical reason as too why its not insterting the data into the database ... heres the part we're looking at :

if($action == "submit") {
eval("\$camsubmit = \"".template("cam_submit")."\";");
echo $camsubmit;
eval("\$camfooter = \"".template("cam_footer")."\";");
echo $camfooter;
end_time();
eval("\$footer = \"".template("footer")."\";");
echo $footer;
exit;

if(!$submit) {
eval("\$camsubmit = \"".template("cam_submit")."\";");
echo $camsubmit;
}

else {
$email = checkInput($email, '', '', 'javascript');
$cam = checkInput($cam, '', '', 'javascript');
$website = checkInput($website, '', '', 'javascript');

$description = addslashes($description);
$ip = $_SERVER['REMOTE_ADDR'];
$adate = date("D jS M y");

$db->query ("INSERT INTO $table_cam_temp VALUES ('', '$xmbuser', '$email', '$cam', '$website', '$adate', '$ip')");
}
}

AND HERES MY FORM:

<form method="post" action="?action=submit">
<table cellspacing="0" cellpadding="0" border="0" width="$tablewidth" align="center">
<tr>
<td bgcolor="$bordercolor">
<table cellspacing="$borderwidth" cellpadding="$tablespace" border="0" width="100%" align="center">
<tr>
<td bgcolor="$altbg1" class="tablerow">$lang_cam_addemail</td>
<td bgcolor="$altbg2" class="tablerow"><input type="text" name="email" class="text"></td>
</tr>
<td bgcolor="$altbg1" class="tablerow">$lang_cam_addcam</td>
<td bgcolor="$altbg2" class="tablerow"><input type="text" name="cam" class="text"></td>
<tr>
<td bgcolor="$altbg1" class="tablerow">$lang_cam_addsite</td>
<td bgcolor="$altbg2" class="tablerow"><input type="text" name="website" class="text"></td>
</tr>
</table>
</td>
</tr>
</table>
<br>
<center><input type="submit" name="submit" value="$lang_cam_submitcam" class="submit"></center>
</form>

Can anyone see why this isnt working?

Oh and my database goes,... id, user, email, cam, website, adate, ip
Reply With Quote
  #2 (permalink)  
Old 02-04-04, 06:56 AM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
it seems you are using OO in this..
but I want to check did you define a function instead of using mysql_query ?
I mean I am seeing this :
PHP Code:

$db->query ("INSERT INTO $table_cam_temp VALUES ('', '$xmbuser', '$email', '$cam', '$website', '$adate', '$ip')"); 

instead of this :
PHP Code:

$db->mysql_query ("INSERT INTO $table_cam_temp VALUES ('', '$xmbuser', '$email', '$cam', '$website', '$adate', '$ip')"); 

anyway please use the highlighter to make the code clearer to view by using [ php ] (without space)
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
Reply With Quote
  #3 (permalink)  
Old 02-04-04, 11:10 PM
simone's Avatar
simone simone is offline
Newbie Coder
 
Join Date: Nov 2003
Posts: 67
Thanks: 0
Thanked 0 Times in 0 Posts
see im creating an xmb hack, so basically i should be able to use the coding they use in other part of their script, cept this definetly isnt working ..i also tried $db->mysql_query and i get the same result.
Reply With Quote
  #4 (permalink)  
Old 02-05-04, 01:01 AM
brett brett is offline
Newbie Coder
 
Join Date: Feb 2004
Location: Seattle, WA
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by simone
("INSERT INTO $table_cam_temp VALUES ('', '$xmbuser', '$email', '$cam', '$website', '$adate', '$ip')");
I don't believe this is a valid method of inserting a record (could be wrong). I am pretty sure you need and should specify which columns these values are being submitted to.

Ex:

INSERT INTO $table_cam_temp VALUES (id, user, email, cam, website, adate, ip, '$xmbuser', '$email', '$cam', '$website', '$adate', '$ip')");
Reply With Quote
  #5 (permalink)  
Old 02-05-04, 02:56 AM
simone's Avatar
simone simone is offline
Newbie Coder
 
Join Date: Nov 2003
Posts: 67
Thanks: 0
Thanked 0 Times in 0 Posts
no u can do it how mine is coded ..i also tried your way, with no luck.
Reply With Quote
  #6 (permalink)  
Old 02-05-04, 04:20 AM
eddyvlad eddyvlad is offline
Wannabe Coder
 
Join Date: Sep 2003
Location: In The Bloody Pits Of Hell
Posts: 160
Thanks: 2
Thanked 0 Times in 0 Posts
Try this?

INSERT INTO $table_cam_temp (id, user, email, cam, website, adate, ip) VALUES ('$xmbuser', '$email', '$cam', '$website', '$adate', '$ip')
__________________
Mr. Brown Eyes
Reply With Quote
  #7 (permalink)  
Old 02-05-04, 05:05 AM
simone's Avatar
simone simone is offline
Newbie Coder
 
Join Date: Nov 2003
Posts: 67
Thanks: 0
Thanked 0 Times in 0 Posts
yehh i've tried that aswell :\
Reply With Quote
  #8 (permalink)  
Old 02-05-04, 05:28 AM
ermau's Avatar
ermau ermau is offline
Wannabe Coder
 
Join Date: Aug 2003
Location: Florida, USA
Posts: 240
Thanks: 0
Thanked 0 Times in 0 Posts
I must ask though, why use eval all over the place when it's really not needed?
__________________
PHP / mySQL Developer
Reply With Quote
  #9 (permalink)  
Old 02-06-04, 02:27 AM
simone's Avatar
simone simone is offline
Newbie Coder
 
Join Date: Nov 2003
Posts: 67
Thanks: 0
Thanked 0 Times in 0 Posts
ah because its following the basic xmb script, its best to stick to the way they do it, so if people were to mod this script, they'd know what everything is.
Reply With Quote
  #10 (permalink)  
Old 02-06-04, 10:34 PM
tltran tltran is offline
Newbie Coder
 
Join Date: Jan 2004
Location: Montreal
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
I suggest to build the SQL string into variable and then display your query

Try to do so:

$sql = "insert... () values ($yourvariable1, .... )";

echo $sql; // display your real sql string
mysql_query($sql)... // call the mysql_query function

if it don't work try to execute your $sql string into phpmyadmin. If it don't work, it mean that your query string is not good.
__________________
Thanh Liem Tran
When You have to run, you have to run
http://www.irunsoft.com
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting PHP forum inside layout page xeoh PHP 1 12-18-03 06:34 PM
inserting images into mysql coatsey PHP 3 12-01-03 07:04 PM
form not inserting information into the database sabret00the PHP 7 12-01-03 03:35 PM
getting -2147217900 error while inserting and updating skchakri ASP 3 09-20-03 10:34 AM
More inserting problems Psybadek PHP 7 06-17-03 04:39 AM


All times are GMT -5. The time now is 08:16 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.