Jump to content

[SOLVED] Using an array with a db query


spillage

Recommended Posts

Sorry to be a noobie pain in the butt but having problems trying to work this one out.

 

if $cust=$_POST['all']{
while($row = mysql_fetch_array($result))
   {
echo $row['printer_type']."  | ".$row['Cust_Email']," | ".$row['Friends_Email'];
    echo "<br />";
   }}
   
else if $cust=$_POST['cust']
   {
while($row = mysql_fetch_array($result))
   {
echo $row['printer_type']."  | ".$row['Cust_Email']," | ";
    echo "<br />";
   }}

 

$cust is from a drop down menu which is working as I can echo the result and get the corrct output

and though the above would work but have searched around the correct answer without joy and starting

to really struggling.

 

If I am (and probally am) being a thick idiot please let me know and Ill spent a while longer searching for the

answer as I quite often have my brain in the wrong gear.

 

Cheers,

 

Spill

Link to comment
https://forums.phpfreaks.com/topic/104426-solved-using-an-array-with-a-db-query/
Share on other sites

is as follows

 

$result = mysql_query("SELECT * FROM submit WHERE printer_type LIKE '%$printer%'");

 

if this is used with

while($row = mysql_fetch_array($result))
   {
echo $row['printer_type']."  | ".$row['Cust_Email'],";
    echo "<br />";
}

this works fine regardless of which $row I select to be printed. But am trying to select the results printed.

 

Spill

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.