Jump to content

Help with PHP/MS ACCESS


jkewlo

Recommended Posts

Hello I am helping a friend do some home work for school

 

ok what im trying to do

 

I have links that have hardcoded id's

 

artnDesign.php?id=General_Art

 

well in my php code i need that id=General_Art to be called from a MS ACCESS database not MySQL so it will need to search the database for General_Art and display all the books with the category General_Art

 

here is the code that i am using

 

artnDesign.php?id=General_Art

<?

	$addy = @$_GET[id];


$cs = odbc_connect("Rainwater", "", "");
$res = odbc_exec($cs, "SELECT Product_id, Catergory, Title, Author, Price, Description 
FROM [books] 
WHERE id= ".$addy."
ORDER BY Product_id ");

 

this is the error I am getting from that

 

now I know ASP damn good

 

and I have done this in ASP and was very simple but cant seem to figure it out in PHP

 

can someone please help me with this thanks

 

~Johnny

Link to comment
Share on other sites

sorry i forgot to post my error

 

 

Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1., SQL state 07001 in SQLExecDirect in C:\wamp\www\pro\project\artnDesign.php on line 172

Link to comment
Share on other sites

I think your problem is actually in the connect, not the query.  I notice you are using a dsn name for your first parameter below.  If that is not defined by the system you are on, then an error will occur and the connection will not be created. 

 

To see if the connect worked, use an echo right after it.  If it echoes out '0', or 'false', or nothing, then an error occurred in creating your connection.

 

$cs = odbc_connect("Rainwater", "", "");
echo 'my odbc connection: ' . $cs;

Link to comment
Share on other sites

$conn=odbc_connect('Rainwater','','');
if (!$conn)
  {exit("Connection Failed: " . $conn);}
$sql="SELECT * 
FROM Books 
WHERE id = '".$var."'
ORDER BY Product_id ";
$rs=odbc_exec($conn,$sql);
if (!$rs)
  {exit("Error in SQL");}

 

i have " " around it it gives me this error when i do it

 

Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1., SQL state 07001 in SQLExecDirect in C:\wamp\www\pro\project\artnDesign.php on line 176

Error in SQL

Link to comment
Share on other sites

<!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>Rain Water</title>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>

<body onLoad="MM_preloadImages('buttons/artanddesignover.gif','new%20buttons/art&designover.gif','new%20buttons/achiover.gif','new%20buttons/businessover.gif','new%20buttons/childover.gif','new%20buttons/computingover.gif','new%20buttons/crimeover.gif','new%20buttons/educationover.gif','new%20buttons/fictionover.gif','new%20buttons/foodover.gif','new%20buttons/healthover.gif','new%20buttons/historyover.gif','new%20buttons/homeover.gif','new%20buttons/mindover.gif','new%20buttons/musicover.gif','new%20buttons/poetryover.gif','new%20buttons/philoover.gif','new%20buttons/reigionover.gif','new%20buttons/romanceover.gif','new%20buttons/scienceover.gif','new%20buttons/sportover.gif','new%20buttons/travelover.gif')">
<table width="1024" border="0" cellpadding="0" cellspacing="0">
  <!--DWLayoutTable-->
  <tr>
    <td height="123" colspan="5" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
        <td width="1024" height="123"><img src="logo.gif" width="1100" height="290" ></td>
      </tr>
    </table>    </td>
  </tr>
  <tr>
    <td width="200" rowspan="3" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
         <td><a href="artnDesign.php?id=General_Art" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('art','','new%20buttons/art&designover.gif',1)"><img src="new%20buttons/art&design.gif" name="art" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="artnDesign.php?id=Architecture" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('achi','','new%20buttons/achiover.gif',1)"><img src="new%20buttons/achi.gif" name="achi" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="artnDesign.php?id=Business_Finanace" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('busi','','new%20buttons/businessover.gif',1)"><img src="new%20buttons/business.gif" name="busi" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="artnDesign.php?id=Children" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('child','','new%20buttons/childover.gif',1)"><img src="new%20buttons/child.gif" name="child" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="artnDesign.php?id=Computing" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('comp','','new%20buttons/computingover.gif',1)"><img src="new%20buttons/computing.gif" name="comp" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="artnDesign.php?id=Crime_Mystery" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('crime','','new%20buttons/crimeover.gif',1)"><img src="new%20buttons/crime.gif" name="crime" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="artnDesign.php?id=Education" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('educ','','new%20buttons/educationover.gif',1)"><img src="new%20buttons/education.gif" name="educ" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="artnDesign.php?id=Fiction" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('fic','','new%20buttons/fictionover.gif',1)"><img src="new%20buttons/fiction.gif" name="fic" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="artnDesign.php?id=Food_Drink" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('food','','new%20buttons/foodover.gif',1)"><img src="new%20buttons/food.gif" name="food" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="artnDesign.php?id=Health" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('hea','','new%20buttons/healthover.gif',1)"><img src="new%20buttons/health.gif" name="hea" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="artnDesign.php?id=History" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('his','','new%20buttons/historyover.gif',1)"><img src="new%20buttons/history.gif" name="his" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="artnDesign.php?id=Home_Garden" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('home','','new%20buttons/homeover.gif',1)"><img src="new%20buttons/home.gif" name="home" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="artnDesign.php?id=Horror" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('horro','','new%20buttons/horrorover.gif',1)"><img src="new%20buttons/horror.gif" name="horro" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="artnDesign.php?id=Mind_body_Spirit" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('mind','','new%20buttons/mindover.gif',1)"><img src="new%20buttons/mind.gif" name="mind" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="artnDesign.php?id=Music_Stage_Screen" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('music','','new%20buttons/musicover.gif',1)"><img src="new%20buttons/music.gif" name="music" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="artnDesign.php?id=Poetry_Drama" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('poerty','','new%20buttons/poetryover.gif',1)"><img src="new%20buttons/poetry.gif" name="poerty" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="artnDesign.php?id=Philosophy_Drama" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('philo','','new%20buttons/philoover.gif',1)"><img src="new%20buttons/philo.gif" name="philo" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="artnDesign.php?id=Religion" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('reli','','new%20buttons/reigionover.gif',1)"><img src="new%20buttons/reigion.gif" name="reli" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="artnDesign.php?id=Romance" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('rom','','new%20buttons/romanceover.gif',1)"><img src="new%20buttons/romance.gif" name="rom" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="artnDesign.php?id=Science_Fiction" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('sci','','new%20buttons/scienceover.gif',1)"><img src="new%20buttons/science.gif" name="sci" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="artnDesign.php?id=Sport" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('spo','','new%20buttons/sportover.gif',1)"><img src="new%20buttons/sport.gif" name="spo" width="193" height="19" border="0"></a></td>
        </tr>
        <tr> 
          <td><a href="artnDesign.php?id=Travel_Holiday" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('tra','','new%20buttons/travelover.gif',1)"><img src="new%20buttons/travel.gif" name="tra" width="193" height="19" border="0"></a></td></      </tr>
    </table>    </td>
    <td height="27" colspan="4" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
        <td width="25" height="16"></td>
        <td width="30" valign="top"></td>
        <td width="731"></td>
        <td width="58" rowspan="2" valign="top"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="42" height="16" align="right">
          <param name="movie" value="text4.swf">
          <param name="quality" value="high">
          <param name="base" value=".">
          <param name="scale" value="exactfit">
          <embed src="text4.swf" width="42" height="16" align="right" base="."  quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" scale="exactfit" ></embed> 
          </object></td>
    <td width="73" rowspan="2" valign="top"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="48" height="20" align="right">
      <param name="movie" value="text8.swf">
      <param name="quality" value="high">
      <param name="base" value=".">
      <param name="scale" value="exactfit">
      <embed src="text8.swf" width="48" height="20" align="right" base="."  quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" scale="exactfit" ></embed> 
    </object></td>
    <td width="107" rowspan="2" valign="top"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="80" height="19" align="right">
      <param name="movie" value="text9.swf">
      <param name="quality" value="high">
      <param name="base" value=".">
      <param name="scale" value="exactfit">
      <embed src="text9.swf" width="80" height="19" align="right" base="."  quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" scale="exactfit" ></embed> 
    </object></td>
    <td width="128" rowspan="2" valign="top"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="86" height="16" align="right">
        <param name="movie" value="text10.swf">
        <param name="quality" value="high">
        <param name="base" value=".">
        <param name="scale" value="exactfit">
        <embed src="text10.swf" width="86" height="16" align="right" base="."  quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" scale="exactfit" ></embed> 
      </object></td>
        </tr>
      <tr>
        <td height="19"></td>
        <td> </td>
        <td></td>
      </tr>
    </table>    </td>
  </tr>
  <tr>
    <td height="344" colspan="3" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
        <td width="8" height="48"></td>
        <td width="79" rowspan="2" valign="top"></td>
    <td width="100%" valign="top"> 
          <?
	  

	$var = @$_GET[id];
	$trimmed = trim($var);

	$conn=odbc_connect('Rainwater','','');
if (!$conn)
  {exit("Connection Failed: " . $conn);}
$sql="SELECT * 
FROM Books 
WHERE id = '".$var."'
ORDER BY Product_id ";
$rs=odbc_exec($conn,$sql);
if (!$rs)
  {exit("Error in SQL");}

echo "<TABLE width=100%>";
echo "<TR BGCOLOR=\"#C6FF4B\" width=100%>";
echo "<TH width=123 height=21 valign=top>Product_id</TH>";
echo "<TH width=110 valign=top>Catergory</TH>";
echo "<TH width=222 valign=top>Title</TH>";
echo "<TH width=123 valign=top>Author</TH>";
echo "<TH width=143 valign=top>Price</TH>";
echo "<TH width=118> </TH>
   <TH width=227> </TH>
   <TH width=433> </TH>
</TR>


  <TR>";
$Pro=odbc_result($rs,"Product_id");
$Cat=odbc_result($rs,"Catergory");
$Tit=odbc_result($rs,"Title");
$Aut=odbc_result($rs,"Author");
$Pri=odbc_result($rs,"Price");
echo "<TD height=21 valign=top>".$Pro."</TD>";
echo" <TD valign=top>".$Cat."</TD>";
echo" <TD valign=top>".$Tit."</TD>";
echo" <TD valign=top>".$Aut."</TD>";
echo" <TD valign=top>".$Pri."</TD>";

echo" <TD valign=top> <a href=viewmore.php?Product_id=>View More Details</a> </TD>
  <TD rowspan=2 valign=top> <form method=post action=add_tobasket.php?>
        How Many:
        <SELECT NAME=quantity>
          <option value=1>1
          <option value=2>2 
          <option value=3> 3 
          <option value=4>4 
          <option value=5>5
        </select | >
        <input type=submit value=Add to basket>
        <input name=reset type=reset value=Reset>
        </form></TD>
  <TD> </TD>
  </TR>
  <TR>
    <TD height=3></TD>
    <TD></TD>
    <TD></TD>
    <TD></TD>
    <TD></TD>
    <TD></TD>
    <TD></TD>
  </TR>
  <TR>
    <TD height=40></TD>
    <TD></TD>
    <TD></TD>
    <TD></TD>
    <TD></TD>
    <TD></TD>
    <TD> </TD>
    <TD></TD>
  </TR>
  
  
  
      </TABLE>";
  odbc_close($conn);
?>    </td>
    
        <td width="482"> </td>
      </tr>
      
      <tr>
        <td height="52"></td>
        <td> </td>
        <td> </td>
        <td> </td>
      </tr>
      
      <tr>
        <td height="244"> </td>
        <td> </td>
        <td> </td>
        <td> </td>
        <td> </td>
      </tr>
      
      
    </table>    </td>
    <td width="110"> </td>
  </tr>
  <tr>
    <td width="162" height="47"> </td>
    <td width="428"> </td>
    <td width="200"> </td>
    <td> </td>
  </tr>
  <tr>
    <td height="38"></td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td></td>
  </tr>
  <tr>
    <td height="22"></td>
    <td> </td>
    <td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
        <td width="428" height="22"> <div align="center"><BR>
  <BR>
   © <FONT FACE ='Arial' size="2" > Rainwater Limited </FONT> <BR>
  <BR>
  <table width="800" border="0">
        <tr>
          <td><div align="center">
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="85" height="13">
            <param name="movie" value="text15.swf">
            <param name="quality" value="high">
            <param name="base" value=".">
            <param name="scale" value="exactfit">
            <embed src="text15.swf" base="."  quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" scale="exactfit" width="85" height="13" ></embed> 
          </object>
        </div></td>
          <td><div align="center">
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="93" height="14">
            <param name="movie" value="text16.swf">
            <param name="quality" value="high">
            <param name="base" value=".">
            <param name="scale" value="exactfit">
            <embed src="text16.swf" base="."  quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" scale="exactfit" width="93" height="14" ></embed> 
          </object>
        </div></td>
          <td><div align="center">
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="57" height="14">
            <param name="movie" value="text17.swf">
            <param name="quality" value="high">
            <param name="base" value=".">
            <param name="scale" value="exactfit">
            <embed src="text17.swf" base="."  quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" scale="exactfit" width="57" height="14" ></embed> 
          </object>
        </div></td>
          <td><div align="center">
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="71" height="16">
            <param name="movie" value="text18.swf">
            <param name="quality" value="high">
            <param name="base" value=".">
            <param name="scale" value="exactfit">
            <embed src="text18.swf" base="."  quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" scale="exactfit" width="71" height="16" ></embed> 
          </object>
        </div></td>
          <td><div align="center">
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="99" height="16">
            <param name="movie" value="text19.swf">
            <param name="quality" value="high">
            <param name="base" value=".">
            <param name="scale" value="exactfit">
            <embed src="text19.swf" base="."  quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" scale="exactfit" width="99" height="16" ></embed> 
          </object>
        </div></td>
        </tr>
      </table>
  <BR>
</div></td>
      </tr>
    </table>
    </td>
    <td> </td>
    <td></td>
  </tr>
</table>
</body>
</html>

Link to comment
Share on other sites

there errors are making me mad

 

ok my links are hardcoded with the ID

 

artnDesign.php?id=General_Art

 

so i want to have the artnDesign.php? to get the id which equals General_Art and have the

<?
	  

	$var = @$_REQUEST[id];


	$conn=odbc_connect('Rainwater','','');
if (!$conn)
  {exit("Connection Failed: " . $conn);}
$sql="SELECT * 
FROM Books 
WHERE [id] = '".$var."'
ORDER BY Product_id ";
$rs=odbc_exec($conn,$sql);
if (!$rs)
  {exit("Error in SQL");}

echo "<TABLE width=100%>";
echo "<TR BGCOLOR=\"#C6FF4B\" width=100%>";
echo "<TH width=123 height=21 valign=top>Product_id</TH>";
echo "<TH width=110 valign=top>Catergory</TH>";
echo "<TH width=222 valign=top>Title</TH>";
echo "<TH width=123 valign=top>Author</TH>";
echo "<TH width=143 valign=top>Price</TH>";
echo "<TH width=118> </TH>
   <TH width=227> </TH>
   <TH width=433> </TH>
</TR>


  <TR>";
$Pro=odbc_result($rs,"Product_id");
$Cat=odbc_result($rs,"Catergory");
$Tit=odbc_result($rs,"Title");
$Aut=odbc_result($rs,"Author");
$Pri=odbc_result($rs,"Price");
echo "<TD height=21 valign=top>".$Pro."</TD>";
echo" <TD valign=top>".$Cat."</TD>";
echo" <TD valign=top>".$Tit."</TD>";
echo" <TD valign=top>".$Aut."</TD>";
echo" <TD valign=top>".$Pri."</TD>";

echo" <TD valign=top> <a href=viewmore.php?Product_id=>View More Details</a> </TD>
  <TD rowspan=2 valign=top> <form method=post action=add_tobasket.php?>
        How Many:
        <SELECT NAME=quantity>
          <option value=1>1
          <option value=2>2 
          <option value=3> 3 
          <option value=4>4 
          <option value=5>5
        </select | >
        <input type=submit value=Add to basket>
        <input name=reset type=reset value=Reset>
        </form></TD>
  <TD> </TD>
  </TR>
  <TR>
    <TD height=3></TD>
    <TD></TD>
    <TD></TD>
    <TD></TD>
    <TD></TD>
    <TD></TD>
    <TD></TD>
  </TR>
  <TR>
    <TD height=40></TD>
    <TD></TD>
    <TD></TD>
    <TD></TD>
    <TD></TD>
    <TD></TD>
    <TD> </TD>
    <TD></TD>
  </TR>
  
  
  
      </TABLE>";
  odbc_close($conn);
?>
code open the database and search the database for [code]$var = $_GET[id];

but it keeps telling me

Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1., SQL state 07001 in SQLExecDirect in C:\wamp\www\pro\project\artnDesign.php on line 176
Error in SQL

 

its not hard to do i just cant figure it out

 

this is my ASP code

strSQL = "SELECT Vendor, Description, Quantity, Namecontains, ID, Price FROM Items where [id] = " & ID

i want the PHP code do the same thing.[/code]

Link to comment
Share on other sites

maybe it's just choking because you have line feeds in your sql statement below.  Some db's will not accept that and will generate an error.

$res = odbc_exec($cs, "SELECT Product_id, Catergory, Title, Author, Price, Description 
FROM [books] 
WHERE id= ".$addy."
ORDER BY Product_id ");

Link to comment
Share on other sites

yeah i have them all named right. its weird. lol maybe it is the underscore _ hemm i will mess with that some and let you know in a minute

 

thanks

 

 

also

 

i dont know why her teacher is making her use ms access kinda dumb is u ask me MySQL would be alot easier and id have this shopping cart finished by now.

Link to comment
Share on other sites

ugh i feel like a dumb ash! lol i didnt rename the Catergory fields to match the "id" it was General Art. its crazy how little things can take away 2 days of work

 

how would i make it display more than 1 table at a time?

 

grab all the info in the database that has the Catergory General_Art and echo them all onto the table? a loop statement?

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.