PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
PHP_ColdFusion
Forum Newbie
Posts: 21 Joined: Thu Jan 04, 2007 2:16 pm
Location: Leesville, Louisiana, USA
Post
by PHP_ColdFusion » Thu Jan 04, 2007 2:22 pm
feyd | Please use Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
The Following code will not show the rows of information on my page after the header. is it not pulling it out of the database? i know its putting it in the database at least. in the data base on that table i have 3,2 which is the corrisponding information that is supposed to go in the database on the implode. but why wont it explode that same data? Please someone help me i've been beating this script up all day.
Thnx,
PhP_ColdFusionCode: Select all
// if edit => Print
case 'Print':
if (isset($_POST['select'])) {
$Printed = implode(",", $select);
}
$Printed2 = explode(",",$myrow["Print"]);
$sel = "UPDATE print
SET Print = '" . $Printed . "'
WHERE Num = '1'";
$sel2 = "select *
FROM products
WHERE ProductID = '" . . "'";
$result = mysql_query($sel,$con);
if (!mysql_query($sel,$con))
{
echo '<tr>';
echo '<td><CENTER>';
echo 'Error: ' . mysql_error();
echo '<br><a href="javascript:history.go(-1);">Go Back</a>';
echo '</td>';
echo '</tr>';
die();
} elseif (mysql_query($sel,$con)) {
echo '<frame width=600>';
include 'templates/paperhead.php';
while($row = mysql_fetch_array($result))
{
echo '<tr>';
echo '<td style="border:none;">'.$row['ProductID'].'</td>';
echo '<td style="border:none;">'.$row['category'].'</td>';
echo '<td style="border:none;">'.$row['Supplier'].'</td>';
echo '<td style="border:none;">'.$row['Serial'].'</td>';
echo '<td style="border:none;">'.$row['Product'].'</td>';
echo '<td style="border:none;">'.$row['Description'].'</td>';
echo '<td style="border:none;">'.$row['LeadTime'].'</td>';
echo '<td style="border:none;">$ '.$row['UnitPrice'].'</td>';
echo '<td align=right style="border:none;"> '.$row['UnitsOnHand'].'</td>';
echo '</tr>';
}
echo '</frame>';
die();
}
break;
}
?>
feyd | Please use Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Thu Jan 04, 2007 2:56 pm
Where is $myrow set and what is it set to?
PHP_ColdFusion
Forum Newbie
Posts: 21 Joined: Thu Jan 04, 2007 2:16 pm
Location: Leesville, Louisiana, USA
Post
by PHP_ColdFusion » Thu Jan 04, 2007 3:14 pm
after loking back over that i noticed that i didn't have some stuff right (eg. myrow and other things.)
this one is what i needed to send lol.
Code: Select all
// if edit => Print
case 'Print':
if (isset($_POST['select'])) {
$Printed = implode(",", $select);
}
$sel = "UPDATE print
SET Print = '" . $Printed . "'
WHERE Num = '1'";
$sel2 = "SELECT Print FROM print
WHERE Num = '1'";
$result = mysql_query($sel2,$con);
$Printed2 = explode(",", mysql_fetch_array($result));
$sel3 = "SELECT *
FROM products
WHERE ProductID = '" . $Printed2 . "'";
$result2 = mysql_query($sel3,$con);
if (!mysql_query($sel,$con))
{
echo '<tr>';
echo '<td><CENTER>';
echo 'Error: ' . mysql_error();
echo '<br><a href="javascript:history.go(-1);">Go Back</a>';
echo '</td>';
echo '</tr>';
die();
} elseif (mysql_query($sel2,$con)) {
echo '<frame width=600>';
echo $Printed2;
include 'templates/paperhead.php';
while($row = mysql_fetch_array($result2)) {
echo '<tr>';
echo '<td style="border:none;">'.$row['ProductID'].'</td>';
echo '<td style="border:none;">'.$row['category'].'</td>';
echo '<td style="border:none;">'.$row['Supplier'].'</td>';
echo '<td style="border:none;">'.$row['Serial'].'</td>';
echo '<td style="border:none;">'.$row['Product'].'</td>';
echo '<td style="border:none;">'.$row['Description'].'</td>';
echo '<td style="border:none;">'.$row['LeadTime'].'</td>';
echo '<td style="border:none;">$ '.$row['UnitPrice'].'</td>';
echo '<td align=right style="border:none;"> '.$row['UnitsOnHand'].'</td>';
echo '</tr>';
}
echo '</frame>';
die();
}
break;
John Cartwright
Site Admin
Posts: 11470 Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:
Post
by John Cartwright » Thu Jan 04, 2007 3:18 pm
you might want to edit your post to include
Code: Select all
tags, feyd was kind enough to do it for you the first time.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Thu Jan 04, 2007 3:27 pm
mysql_fetch_array() returns an array.
Explode() does not operate on arrays.
PHP_ColdFusion
Forum Newbie
Posts: 21 Joined: Thu Jan 04, 2007 2:16 pm
Location: Leesville, Louisiana, USA
Post
by PHP_ColdFusion » Thu Jan 04, 2007 3:28 pm
oh hum... is there any way to do what i am looking to do then?
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Thu Jan 04, 2007 3:35 pm
Take a look at what
mysql_fetch_array() is returning.
PHP_ColdFusion
Forum Newbie
Posts: 21 Joined: Thu Jan 04, 2007 2:16 pm
Location: Leesville, Louisiana, USA
Post
by PHP_ColdFusion » Thu Jan 04, 2007 3:49 pm
ok yeah you lost me there
PHP_ColdFusion
Forum Newbie
Posts: 21 Joined: Thu Jan 04, 2007 2:16 pm
Location: Leesville, Louisiana, USA
Post
by PHP_ColdFusion » Thu Jan 04, 2007 3:54 pm
nice icon btw
PHP_ColdFusion
Forum Newbie
Posts: 21 Joined: Thu Jan 04, 2007 2:16 pm
Location: Leesville, Louisiana, USA
Post
by PHP_ColdFusion » Thu Jan 04, 2007 4:28 pm
n/m i get it now
i wasn't sure exactly how the explode function worked.
thanks guys