logo-dw

Go Back   Dreamweaver Club Forums > Dreamweaver forums > Video Tutorials
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 04-27-2007, 12:50 PM   #1
ali_b
 
Join Date: Apr 2007
Posts: 80
Default Dropdown tutorial help

Hello,

I have completed the beginners tutorial and i moved onto the dropdown neu tutorial.

i tested it but im getting this error.

"Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Documents and Settings\Ali\My Documents\web root\test\dropdown.php on line 10"

Line 10 is :
PHP Code:
$rowModel  mysql_fetch_array($result); 
I put @ at the beginging of mysql... dont no if i should have done that but i tried it again but the second dropdown doesnt populate.

here is my code:

PHP Code:
<?php
require_once("connections/connection.php"); // database connection
$make $_POST['make'];
if (
$make){
/////////////////////////////////////////////
$query   sprintf("SELECT * FROM car_model where care_model_id='$make'");
$result  = @mysql_query($query);
$rowModel  mysql_fetch_array($result);
/////////////////////////////////////////////
}
?>
<!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>Untitled Document</title>
</head>
<body>
<form form id="form1" name="form1" action="dropdown.php" method="post">
<select name="make" onChange="document.forms[0].submit()">
 <option value"" selected>Select Make</option>
 <option value="1">Alfa Romeo</option>
 <option value="2">Audi</option>
 <option value="3">BMW</option>
 <option value="4">Citroen</option>
 </select>
 
<select name="model">
 <option value="">Select Model</option>
 <?php do { ?>
 <option value="<?php echo $rowModel['car_model_id']; ?>"><?php echo $rowModel['car_model']; ?></option>
 <?php }while ($rowModel mysql_fetch_array($result)); ?>
 </select>
</form>
</body>
</html>
cheers for ur help in advance
ali_b is offline   Reply With Quote
Old 04-27-2007, 01:23 PM   #2
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

post the code

all of the code as you have written it
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 04-27-2007, 01:27 PM   #3
ali_b
 
Join Date: Apr 2007
Posts: 80
Default

PHP Code:
<?php
require_once("connections/connection.php"); // database connection
$make $_POST['make'];
if (
$make){
/////////////////////////////////////////////
$query   sprintf("SELECT * FROM car_model where care_model_id='$make'");
$result  = @mysql_query($query);
$rowModel  mysql_fetch_array($result);
/////////////////////////////////////////////
}
?>
<!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>Untitled Document</title>
</head>
<body>
<form form id="form1" name="form1" action="dropdown.php" method="post">
<select name="make" onChange="document.forms[0].submit()">
 <option value"" selected>Select Make</option>
 <option value="1">Alfa Romeo</option>
 <option value="2">Audi</option>
 <option value="3">BMW</option>
 <option value="4">Citroen</option>
 </select>
 
<select name="model">
 <option value="">Select Model</option>
 <?php do { ?>
 <option value="<?php echo $rowModel['car_model_id']; ?>"><?php echo $rowModel['car_model']; ?></option>
 <?php }while ($rowModel mysql_fetch_array($result)); ?>
 </select>
</form>
</body>
</html>
ali_b is offline   Reply With Quote
Old 04-27-2007, 01:30 PM   #4
ali_b
 
Join Date: Apr 2007
Posts: 80
Default

oops i think i may have found the problem


yup my variable was spelt wrong.... oops lol
ali_b is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:16 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com