Jump to content

alanlaw87

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Everything posted by alanlaw87

  1. Hi, I am having problem with mysql and php.... when i test the database on my local host it didt produce any error but when i put it on my web host it gave me error messages... "Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource" Please help me as i am new to php.
  2. Hi I have coded a drop down menu with php and i am trying to retrieve the data when a user select a option from the menu and the data is retrieved from the database. So far i have tried and nothing is displaying when i tried to process the php form. Sales.php Page <form action="saleprocess.php" method="GET"> <?php echo 'Product Model:'; $query="SELECT * FROM products"; /* You can add order by clause to the sql statement if the names are to be displayed in alphabetical order */ $result = mysql_query ($query); echo "<select name=product_model value=Select>Product Model</option>"; // printing the list box select command while($rows=mysql_fetch_array($result)){//Array or records stored in $nt echo "<option name=product_model value='.$rows[product_id].'>$rows[product_model]</option>"; /* Option values are added by looping through the array */ } echo "</select><br>"; ?> <input type='submit' name='submit' value='Create'></input> <br> </form> ******************************************************************************** Salesprocess.php page <?php include("connect.php"); if(isset($_GET['product_id'])){ $product_id = $_GET['product_id']; $query = mysql_query("SELECT * FROM products WHERE product_id= $product_id"); while($rows = mysql_fetch_assoc($query)) { echo 'Product Model<br>'; echo $rows['product_id']; echo $rows['product_model']; } } ?> Muchly appreciated if someone can help me
×
×
  • 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.