why is this not inserting?

02-04-04, 12:45 AM
|
 |
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
|

02-04-04, 06:56 AM
|
 |
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 :
instead of this :
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]
|

02-04-04, 11:10 PM
|
 |
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.
|

02-05-04, 01:01 AM
|
|
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')");
|

02-05-04, 02:56 AM
|
 |
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.
|

02-05-04, 04:20 AM
|
|
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')
|

02-05-04, 05:05 AM
|
 |
Newbie Coder
|
|
Join Date: Nov 2003
Posts: 67
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
yehh i've tried that aswell :\
|

02-05-04, 05:28 AM
|
 |
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
|

02-06-04, 02:27 AM
|
 |
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.
|

02-06-04, 10:34 PM
|
|
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
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|