php - Sorting a list from MySQL alphabetically using two tables for input data -
i have following php:
<?php $con = mysql_connect("localhost","foo","bar"); if (!$con) { die('could not connect: ' . mysql_error()); } mysql_select_db("zed", $con); $gettagid = $_get["id"]; //make loop outputs each coupon has been tagged $alphatagsql = mysql_query("select * coupon_tags tagid = '$gettagid'"); $alphatagsqlarr[] = mysql_fetch_array($alphatagsql); foreach($alphatagsqlarr $mouse) { $nzed = $mouse["couponid"]; $brah = mysql_query("select * coupons couponid = '$nzed'"); $pen[] = mysql_fetch_row($brah); } foreach($pen $ruler) { echo $pen; } ?> what i'm trying select tagid $_get, match of couponid's match in table coupon_tags, match coupon_id's retailername in table coupons, couponid match field id. want list them alphabetically. i'm running few problems - namely, error warning: mysql_fetch_row(): supplied argument not valid mysql result resource.
any help?
try change
$brah = mysql_query("select * coupons couponid = '$nzed'"); into
$brah = mysql_query("select * coupons couponid = '$nzed'") or die(mysql_error()); it give more information on why query didn't succeed.
Comments
Post a Comment