Jump to content

hanadeka80

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

hanadeka80's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. i used your codes but still i'm not able to connect to the database..It falls on the die statement which is "error in selecting db".. and i've check the database name over and over again..i really don't have any idea what's going on..there server is still up by the way..any comments..plss...i really need help ???
  2. pls..i do need help..i can't connect my site to the database that i made. i have already change the details in my php script with the one provided by the web hosting site.pls..help me with this one..i'm getting the error: Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\Program Files\xampp\htdocs\xampp\GPS_Php4\connection.php on line 24 Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in C:\Program Files\xampp\htdocs\xampp\GPS_Php4\connection.php on line 24 <?php $mysql_host = "mysql3.000webhost.com"; $mysql_database = "a5200862_shop"; $mysql_user = "a5200862_tine"; $mysql_password = "youknowwho"; if($con=@mysql_connect($mysql_host,$mysql_user,$mysql_password)) { echo "You are connected"; } else { echo "Not Connected"; } $con=mysql_select_db($mysql_database); ?> i've already check the table names and column also the database name and so on..pls,...help help..i really need to pass this project.. thank you so much in advance!!!
  3. update: as of the moment i figured out the error : Parse error: parse error, unexpected $end in C:\Program Files\xampp\htdocs\xampp\GPS_Php4\checkout.php on line 106 and i'm so so happy..hehehe basically i forgot to put some end curly bracket.. but my problem is still i can't insert any data to the database.. is my insert statement right?? please do check it or the connections is the problem?? thanks so much!! more power !!
  4. regarding with the shopping cart.. uhm i have this code that would insert a statement in the sql server..when you click the buy button now the problem is this error.. Parse error: parse error, unexpected $end in C:\Program Files\xampp\htdocs\xampp\GPS_Php4\checkout.php on line 106 i don't really know how to fix it and i check the closing tags of php and html . and i think i also have some errors regarding the insert statement.. please help me thank you so much in advance well here's the code <?PHP session_start(); $fname=$_SESSION['user']; /*if(!(isset($_SESSION['valid']))) { header('Location:login.php'); exit(); }*/ require 'list.php'; if(@$_POST['submit']=='clear cart') { unset($_SESSION['cart']); } elseif(isset($_POST['update'])) { foreach(@$_POST['update'] as $id=>$p) { if(preg_match('/[0-9]/',$p)) { if($p=='0') { unset($_SESSION['cart'][$id]); } else { $_SESSION['cart'][$id]=$p; } } } } ?> <?php require("connection.php"); if(isset($_POST['buy'])) { if($insert = 1) { $cid=$_POST['cart_id']; $id=$_POST['prod_id']; $name=$_POST['prod_name']; $price=$_POST['prod_price']; $qty=$_POST['quantity']; //$total=$_POST['total']; $sql= "INSERT INTO cart_order VALUES ('".$cid."','".$id."','".$name."',".$price.",".$qty.")"; mysql_query($sql); $resultInsert = $connection ->query($sql); echo "Record save sucessfully"; require("pay.php"); ?> <html> <form action="<?=$_SERVER['PHP_SELF'] ?>" method="post"> <table border=1> <tr> <td>ITEMS</td> <td>Name</td><td>Price</td> <td>Amount</td> </tr> <?php $counter=0; if(@is_array($_SESSION['cart'])) { foreach(@$_SESSION['cart'] as $id=>$count) { $counter++; echo "<tr><td>{$counter}</td><td>{$product[$id]['desc']}</td><td>{$product[$id]['price']}</td><td><input type=\"text\" name=\"update[{$id}]\" value=\"{$count}\"></td></tr>"; $total_value+=$product[$id]['price']*$count; } } ?> <tr><td colspan=3>Total </td><td><?=$total_value ?></td></tr> <tr> <td><input type="button" name="continue" value="continue shopping" onclick="javascript:window.location.href='new_arrival.php' "</td> <td><input type="submit" name="submit" value="clear cart" ></td> <td><input type="submit" name="submit" value="update"></td> <td><input type="button" name="buy" value="buy" onclick="javascript:window.location.href='pay.php' "></td> </tr> </table> </form> </body> </html> please please i relly need help :'(
  5. yup this is is! thanks for the help about the assoc and your right i can't connect to the dB cause of the wrong column name. I'll keep this thread posted..cause i really need help i'm just a student and i really want to learn.. so much thanks to you!
  6. I'm building an add to shopping cart function..and i got this error..please help many thanks in advance.. !! Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:Program Filesxampphtdocsxamppcartmayshoppingcart1.php on line 19 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Cart</title> </head> <body> <form method="post" action="shoppingcart1.php"> ORDERS<br /> <center><input type="submit" name="done" value="CONFIRM ORDERS" /></center> <center><table border="2"><tr><td width="200"><center>PRODUCT NAME</center></td><td width="200"><center>PRODUCT PRICE</center></td><td width="200"><center>QUANTITY ORDERED</center></td><td width="200"><center>TOTAL PRICE</center></td></tr> <? require("connection.php"); $cookie = $_COOKIE['cart']; $getprod = "SELECT productcar.PRODUCT_ID,productcar.PROD_NAME,productcar.PROD_PRICE,orders.QUANTITY,orders.PRICE FROM orders,productcar WHERE orders.CART_ID = '$cookie' and orders.PROD_ID = productcar.PROD_ID"; $val1 = mysql_query($getprod); while($val= mysql_fetch_array($val1)) { $viewProdName = $val['PROD_NAME']; $viewProdPrice = $val['PROD_PRICE']; $viewQUANTITY = $val['QUANTITY']; $viewPRICE = $val['PRICE']; $viewPRODUCT = $val['PRODUCT']; ?><tr><center><td width="200"><center><?=$viewProdName?></center></td><td width ="200"><center><?=$viewProdPrice?></center></td><td width="200"><center><?=$viewQUANTITY?></center></td><td width="200"><center><?=$viewPRICE?></center><td><img width="60" height="60" src=<?=$viewPRODUCT?> /></td> </td></center></tr> <? } ?></table></center> <center><input type="submit" name="done" value="CONFIRM ORDERS" /></center> </form> </body> </html>
×
×
  • 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.