I'm having problem with a php script.  I get a valid insert statment echoed to the 
screen but I don't get a result from it.  If I cut and paste into the SQL query box in 
PHPMyadmin, it insert fine, but it will not do it from the script.

Through debuging (echoing to the screen), I have determinde that it is connecting to 
the database and it does get the variables passed to it, but it just won't work.

Here is the PHP.
<html>
<!-- Coded by the grace of God! -->
<LINK REL=stylesheet HREF="../index.css" TYPE="text/css">
<?
$db = mysql_connect("localhost", "root", "");
mysql_select_db("memberstest",$db);

echo "db = ".$db."<p>";

$date = date("m.d.y");

echo "date ".$date."<p>";

if (!$name || !$year || !$make || !$model || !$pass || !$cab || !$drive || !$active || 
!$mlist || !$pass || !$loc) {
echo "<P><CENTER><TABLE WIDTH=\"500\" BORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\">
<TR>
<TD WIDTH=\"500\"><P><CENTER><FONT SIZE=\"+2\">You didn't fill in the required 
fields!</FONT></CENTER><P><CENTER><FONT SIZE=\"+2\">Press the back button on your 
browser and fill in the required fields which have a </FONT><FONT COLOR=\"#ff0000\" 
SIZE=\"+2\">*</FONT><FONT SIZE=\"+2\"> next to them.</FONT></CENTER></TD>
</TR>
</TABLE>
";
exit();
}

echo "passed requirements<p>";

$sql = "INSERT INTO memberstest VALUES ('', '$name', '$icq', '$loc', '$active', 
'$date', '$mlist', '$email', '$url', '$year', '$make', '$model', '', '$et', '$mph', 
'$six', '$track', '$engine', '$notes', '', '$pass', '$drive', '$cab', '$length', '', 
'$aim', '$irc', '$city', '$bday', '$color', '$emods', '$tmods', '$elec', '$hmods', 
'$bmods', '$app', '$audio', '$user', '$vin')";
echo "sql = ".$sql."<p>";
$result = mysql_query($sql);
echo "result = ".$result."<p>";
$myrow = mysql_fetch_array($result);
echo "my row = ".$myrow."<p>";
if ($result) {
echo "<p><center><B>Thank you!</B><P>Your Member info has been added to the 
database.</center>";
$sql = "SELECT id FROM memberstest WHERE name=$name AND date=$date AND model=$model";
$result = mysql_query($sql);
$myrow = mysql_fetch_array($result);

echo "id = ".$id."<p>";

$pic1 = $id.$picture1_name;
$pic2 = $id.$upicture1_name;

echo "pic1<p>";
if($picture1 == 'none'){
$pic1="na.gif";
}
echo $pic1."<p>";

echo "pic2<p>";
if($upicture1 == 'none'){
$pic2="na.gif";
}
echo $pic2."<p>";

$sql = "UPDATE memberstest SET $pic1='$pic1' and $pic2='$pic2' WHERE id=$id";
exec("cp $picture1 /var/www/html/members/images/$pic1");
exec("cp $upicture1 /var/www/html/members/images/$pic2");

echo $pic1."<p>";
echo $pic2."<p>";

echo "<head><meta HTTP-EQUIV=\"Refresh\" CONTENT=\"10\" 
URL=\"http://www.s-series.org/member/detail-wip?".$myrow["id"]."></head>";


Here is what gets echoed to the screen.

db = Resource id #1
date 02.20.01 
passed requirements 
sql = INSERT INTO memberstest VALUES ('', 'Kenneth R Zink II', '5095094', 'Texas', 
'yes', '02.20.01', 'yes', '[EMAIL PROTECTED]', 
'http://www.s-series.org/htm/firestorm/firestorm.htm', '1985', 'Chevrolet', 'Blazer', 
'', '0.000', '0.000', '0.000', '', '3.4L', '', '', '', '2WD', '2 Door', '', '', '', 
'', 'Spring', '14 December 1976', 'Red', 'See my project page for details.', 'See my 
project page for details.', 'See my project page for details.', 'See my project page 
for details.', 'See my project page for details.', 'See my project page for details.', 
'this is a test. let\'s see if this goes through.', '', '1gtcs14r3h8515786') 

result = 

Warning: Supplied argument is not a valid MySQL result resource in 
/var/www/html/member/add2-wip.php on line 31
my row = 

What am I doing wrong???

I can cut and pas
Kenneth R Zink II     [EMAIL PROTECTED]    ICQ# 5095094
'87 2.8L TBI GMC S-15 Ext. Cab (Hurricane) ...524 in the works !!!  
http://www.s-series.org/htm/windstorm/project-windstorm.htm
'85 3.4L Carbed Chevy S-10 Blazer (FireStorm) ...Soon to be 3.4L SFI DIS !!!  
http://www.s-series.org/htm/firestorm/firestorm.htm
Racing by the Grace of God!!

Reply via email to