Jump to content

Parse Error


Barneyek

Recommended Posts

Split from Parse Error.

 

Are you saying you have the exact same problem as the other poster?

I am getting a parse error from the functions.php page. Could anyone help me with this plz.

 

Parse error: parse error in C:\wamp\www\website\functions.php on line 50

 

<?php
function pf_validate_number($value, $function, $redirect) {
if(isset($value) == TRUE) {
if(is_numeric($value) == FALSE) {
$error = 1;
}
if($error == 1) {
header("Location: " . $redirect);
}
else {
$final = $value;
}
}
else {
if($function == 'redirect') {
header("Location: " . $redirect);
}
if($function == "value") {
$final = 0;
}
}
return $final;
}
function showcart()
{
if($_SESSION['SESS_ORDERNUM'])
{
if($_SESSION['SESS_LOGGEDIN'])
{
$custsql = "SELECT id, status from
orders WHERE customer_id = "
. $_SESSION['SESS_USERID']
. " AND status < 2;";
$custres = mysql_query($custsql);
$custrow = mysql_fetch_assoc($custres);
$custrow = mysql_fetch_assoc($custres);
$itemssql = "SELECT products.*, orderitems.*, orderitems.id AS
itemid FROM products, orderitems WHERE orderitems.product_id =
products.id AND order_id = " . $custrow['id'];
$itemsres = mysql_query($itemssql);
$itemnumrows = mysql_num_rows($itemsres);
}
$itemnumrows = mysql_num_rows($itemsres);
}
else
{
$custsql = "SELECT id, status from orders
WHERE session = '" . session_id()
"' AND status < 2;";
$custres = mysql_query($custsql);
$custrow = mysql_fetch_assoc($custres);
$itemssql = "SELECT products.*,
orderitems.*, orderitems.id AS itemid
FROM products, orderitems WHERE
orderitems.product_id = products.id AND
order_id = " . $custrow['id'];
$itemsres = mysql_query($itemssql);
$itemnumrows = mysql_num_rows($itemsres);
If no SESS_ORDERNUM variable is available, the $itemnumrows variable is set to 0:
$itemnumrows = mysql_num_rows($itemsres);
}
}
else
{
$itemnumrows = 0;
}
$itemnumrows = 0;
}
if($itemnumrows == 0)
{
echo "You have not added anything to your shopping cart yet.";
}
If $itemnumrows has a value, the items are displayed:
echo "You have not added anything to your shopping cart yet.";
}
else
{
echo "<table cellpadding='10'>";
echo "<tr>";
echo "<td></td>";
echo "<td><strong>Item</strong></td>";
echo "<td><strong>Quantity</strong></td>";
echo "<td><strong>Unit Price</strong></td>";
echo "<td><strong>Total Price</strong></td>";
echo "<td></td>";
echo "</tr>";
while($itemsrow = mysql_fetch_assoc($itemsres))
{
$quantitytotal =
$itemsrow['price'] * $itemsrow['quantity'];
echo "<tr>";
if(empty($itemsrow['image'])) {
echo "<td><img
src='./productimages/dummy.jpg' width='50' alt='"
. $itemsrow['name'] . "'></td>";
}
else {
echo "<td><img src='./productimages/" .
$itemsrow['image'] . "' width='50' alt='"
. $itemsrow['name'] . "'></td>";
}
echo "<td>" . $itemsrow['name'] . "</td>";
echo "<td>" . $itemsrow['quantity'] . "</td>";
echo "<td><strong>£"
. sprintf('%.2f', $itemsrow['price'])
. "</strong></td>";
echo "<td><strong>£"
. sprintf('%.2f', $quantitytotal) . "</strong></td>";
echo "<td>[<a href='"
. $config_basedir . "delete.php?id="
. $itemsrow['itemid'] . "'>X</a>]</td>";
echo "</tr>";
$total = $total + $quantitytotal;
$totalsql = "UPDATE orders SET total = "
. $total . " WHERE id = "
. $_SESSION['SESS_ORDERNUM'];
$totalres = mysql_query($totalsql);
}
echo "<tr>";
echo "<td></td>";
echo "<td></td>";
echo "<td></td>";
echo "<td>TOTAL</td>";
echo "<td><strong>£"
. sprintf('%.2f', $total) . "</strong></td>";
echo "<td></td>";
echo "</tr>";
echo "</table>";
echo "<p><a href='checkout-address.php'>Go to the checkout</a></p>";
}
}
?>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.