Jump to content

Coldman

Members
  • Posts

    51
  • Joined

  • Last visited

    Never

Everything posted by Coldman

  1. In this case i will not be able to use any buttons that will refer to the same page ?
  2. but how tu put the aray in session ? please refer to my code and write done one example if possible thanks
  3. Please any help where to put this function unset($var);
  4. $CartID1= "1"; //$_SESSION['cartid']; $var['cartid']= "1"; $var['productid'] = $_GET['var']; $var['productname'] = $_GET['var1']; $var['price'] = $_GET['var2']; $var['quantity'] = "1"; echo $price; $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("manvisdatabse", $con); $query = mysql_query("INSERT INTO cart (CartID,ProductID,ProductName,Price, Quantity, TotalPrice) VALUES ('".$var['cartid']."', '".$var['productid']."', '".$var['productname']."', '".$var['price']."', '".$var['quantity']."', '".$var['price']."')ON DUPLICATE KEY UPDATE Quantity=Quantity+'".$var['quantity']."', TotalPrice=Price*Quantity"); if(!$query) { echo"Query Lesh"; } unset($var); mysql_close($con); I insert the data now but still on refresh one more insertation ??
  5. and than how to insert the variable from aray to database table ??
  6. still not working any other sugestions
  7. the code is here ession_start(); $CartID1= "1"; //$_SESSION['cartid']; $_SESSION['cartid'] = $CartID1; $_SESSION['productid'] = $_GET['var']; $_SESSION['productname'] = $_GET['var1']; $_SESSION['price'] = $_GET['var2']; $_SESSION['quantity'] = "1"; $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("manvisdatabse", $con); $query = mysql_query("INSERT INTO cart (CartID,ProductID,ProductName,Price, Quantity, TotalPrice) VALUES ('{$_SESSION['cartid']}', '{$_SESSION['productid']}','{$_SESSION['productname']}','{$_SESSION['price']}','{$_SESSION['quantity']}','3')ON DUPLICATE KEY UPDATE Quantity=Quantity+'{$_SESSION['quantity']}', TotalPrice=Price*'{$_SESSION['quantity']}'"); if(!$query) { echo"Query Lesh"; } session_destroy(); you see the function session_destroy() i want with this session to destroy the session and in that case when i will do refresh to the site, the data will not be inserted one more time .THis code is not working please any sugestions
  8. i found the solution any way thanks $result = mysql_query ("SELECT SUM(TotalPrice) as sum FROM cart where CartID=$CartID "); $sum = (int) mysql_result($result,0,"sum");
  9. Any help I just want to get the sum of one column i now this is the code but not working, something is missing $query = mysql_query ("SELECT SUM(TotalPrice) FROM cart"); if(!query) { echo "error"; } else echo $query; Any Help
  10. I dont know if you can find up what is happening with this code but lets try $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("manvisdatabse", $con); $query = mysql_query("select * from cart where CartID=$CartID"); $query1 = mysql_query ("SELECT SUM(TotalPrice) FROM Cart"); if(!qyery1) echo "Query lesh"; echo "<table align=center><tr><td width='100' >Product Name</td><td width='80'>Price</td><td width='80'>Quantuty</td><td width='80'>Total Price</td><td width='80'></td></tr></table><br>"; while($row=mysql_fetch_array($query)) { $CartID1=$row['CartID']; $ProductID1=$row['ProductID']; $ProductName1=$row['ProductName']; $Price1= $row['Price']; $Quantity1=$row['Quantity']; $TotalPrice1=$row['TotalPrice']; echo "<table align='center'><tr><td width='100'>$ProductName1</td><td width='80'>$Price1 $</td><td width='80'><input type='text' size=2 Value= $Quantity1 maxlength=5 name='Quantity'>"; echo "</td><td width='80'>$TotalPrice1 $</td><td width='80'><form action='show_cart.php' method='POST'>"; echo "<input type='hidden' size='5' maxlength='5' name='ProductID' Value=$ProductID1>"; echo "<input type='submit' value='Delete'></td></tr></table>"; } echo "<br>"; echo "<table align=center><tr><td width='100' ></td><td width='80'></td><td width='80'></td><td width='80'></td><td width='80'> $query1</td></tr></table><br>"; ?>
  11. What i want to do is this. I have an field in one of my database tables with money price of product, i want to display the total amount of the table, i try to use "select sum(fieldname) from table where" but is not working please any help
  12. Thanks bro i thik it will help me
  13. what i want to do is this: For example i want to display only 10 products in the first page using php and MySql and then after clicking next link to display 10 more products and so on. Simply I want to limit the numbers of products per page. Any tutorial, example etc will help me thanks
  14. Great Thanks man it works here you have the fixed code <?php ?> <table align ="center" > <form action="ManageTopics.php" method="POST"> <tr><td align="left" width=10>Tittle:</td> <td align="left"><input name="title" type="text" size="25" tabindex="1" /> </td></tr> <tr><td align="left" width=10>Area:</td> <td><input name="Area" type="text" size="25" tabindex="2" /></td></tr> <tr><td>Topic Description:</td></tr> <tr><td COLSPAN="2"><textarea name="description" rows="15" cols="60" tabindex="3"></textarea></td></tr> <tr><td><input type="submit" name="CreateTopic" value="Create Topic" /></td></tr> </form> </table> <?php $submit= $_POST['CreateTopic']; if($submit){ $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("cms", $con); $profId=10; $title= $_POST['title']; $Area= $_POST['Area']; $Description= $_POST['description']; if ($title == "" || $Area == "" || $Description == "") { echo "Incorrect Data."; } else { $sql= "REPLACE INTO tbltopics VALUES('$TopicID', '$title', '$Area', '$Description', '$profId')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "The topic Is Aded"; mysql_close($con); } } $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("cms", $con); $query="SELECT Title FROM tbltopics"; $result=mysql_query($query); $num=mysql_numrows($result); echo "<b><center>Your Topics</center></b><br><br>"; $i=0; while ($i < $num) { $tittle=mysql_result($result,$i,"Title"); echo "<Table align = center width='600'>"; $a=$i+1; echo"<tr><td width='6'>$a</td><td width='100'>$tittle</td><td width='60'>View Description</td><td width='70'>Delete</td></tr></b>"; $i++; echo"</table>"; } ?>
  15. Can you tell me in which part to implement this
  16. this is the code. <?php ?> <table align ="center" > <form action="ManageTopics.php" method="POST"> <tr><td align="left" width=10>Tittle:</td> <td align="left"><input name="title" type="text" size="25" tabindex="1" /> </td></tr> <tr><td align="left" width=10>Area:</td> <td><input name="Area" type="text" size="25" tabindex="2" /></td></tr> <tr><td>Topic Description:</td></tr> <tr><td COLSPAN="2"><textarea name="description" rows="15" cols="60" tabindex="3"></textarea></td></tr> <tr><td><input type="submit" name="CreateTopic" value="Create Topic" /></td></tr> </form> </table> <?php $submit= $_POST['CreateTopic']; if($submit){ $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("cms", $con); $TopicID=NULL; $profId=10; $title= $_POST['title']; $Area= $_POST['Area']; $Description= $_POST['description']; $sql= "REPLACE INTO tbltopics VALUES('$TopicID', '$title', '$Area', '$Description', '$profId')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "The topic Is Aded"; mysql_close($con); } $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("cms", $con); $query="SELECT Title FROM tbltopics"; $result=mysql_query($query); $num=mysql_numrows($result); echo "<b><center>Your Topics</center></b><br><br>"; $i=0; while ($i < $num) { $tittle=mysql_result($result,$i,"Title"); echo "<Table align = center width='600'>"; $a=$i+1; echo"<tr><td width='6'>$a</td><td width='100'>$tittle</td><td width='60'>View Description</td><td width='70'>Delete</td></tr></b>"; $i++; echo"</table>"; } ?> And the problem is this: When the forms ar empty and i hit the submit button it records one row in the database with empty fields only the Topic_Id field is recorded. How can I avoid this problem. I was trying to generate an error when forms are empty but id ont know how if someone nows something let me know or any other solution can be very helpfull for me. Thanks
  17. I see you have done this job, can you give me more information, any book, tutorial, or any suggestion to help me finish this task. If so i can count on you with my other projects, or if i can not do some of the projects i can leave it to you, because i really need to do this by my self Thank you
  18. Can you post the URL to see how it works??
  19. Have you lunched your web site to see how it works ??
  20. First thank for your help bro. But i am little confused with this stuff . I see how it works but how i will manage the users credit for example if a product from one user is sold who he will withdraw his credit to his paypall account . P.S I am new with this kind of technique and i really need help.
  21. I was searching over the internet to find any good example, or book that can help me with this technique but nothing. I am working in a project for E-store that sells digital goods, In this kind of E-store the user can upload and sell their digital goods and make money from that , For me it is clear that the technique for such a thing is the technique that i have mentioned with my first post in this Topic. Any help to find good tutorial or book that teaches how to implement this technique will be welcome. Please help !!!
  22. Thank you for your help now have better idea on it .
  23. Hi there I don't know the best term for this topic but the problem is this. I am creating an e-commerce site and i don't want to have a shopping card, i want the user to be able to buy credits using credit c, paypall, moneybookers etc and with those credits to buy products in the future. I need some general idea how this can be done with php and MySql. For example www.bwin.com once you upload your founds than you can beat online, it is something like cyber cash or I dont know . Please someone who knows those things give me one general idea how it works thanks
  24. The problem is like this: I want to delete one row of a mysql table, and still to be in the same page, but the page needs to be reloaded and to give me new results this is the Code: <?php $db="harbini"; $con = mysql_connect('localhost','root',''); mysql_select_db($db); $Quer=mysql_query("select imagepath, IdUser, productName, CompanyName, Serie, Category from cart where Iduser = '$username' "); print "\n"; print "<table >\n"; while ( $rreshti = mysql_fetch_row( $Quer) ) { print "<table >\n"; $i=0; print "<tr>\n"; foreach ( $rreshti as $fusha ) { $i=$i+1; if ($i==1){ print "\t<td > <image src=".$fusha." width=650 height=350></td><td bgcolor=#ffffff>\n"; } else print "\t ".$fusha."</br>\n"; } <form> print '<input type="submit" Value ="Delete" ></td></tr></form></table> </br></td></tr>; print "</table>"; ?>
×
×
  • 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.