Nick50000
asked on
SQL question....
Hi,
Why does this sample of code just produce a blank page?
<?php
$cat=test;
$conn=mysql_connect("host" ,"user","p ass");
if(!$conn){
echo"cant connect";
die;
}
mysql_select_db("testdb");
$qid=mysql_query("SELECT * FROM testtable WHERE cat=$cat");
while($row=mysql_fetch_arr ay($qid)){
?>
<table>
<tr><td><?=$row[heading]?> </td></tr>
<tr><td><?=$row[message]?> </td></tr>
<tr><td><a href="/folder/subfolder/sc ript.php?i d=<?=$row[ id]?>">LIN K</a></td> </tr>
</table>
<br><br>
<?}?>
I am a SQL newbie, and I think there's something wrong with the "SELECT * FROM testtable WHERE cat=$cat" part, but have been unable to fiqure it out.
Thanks,
Nick!
Why does this sample of code just produce a blank page?
<?php
$cat=test;
$conn=mysql_connect("host"
if(!$conn){
echo"cant connect";
die;
}
mysql_select_db("testdb");
$qid=mysql_query("SELECT * FROM testtable WHERE cat=$cat");
while($row=mysql_fetch_arr
?>
<table>
<tr><td><?=$row[heading]?>
<tr><td><?=$row[message]?>
<tr><td><a href="/folder/subfolder/sc
</table>
<br><br>
<?}?>
I am a SQL newbie, and I think there's something wrong with the "SELECT * FROM testtable WHERE cat=$cat" part, but have been unable to fiqure it out.
Thanks,
Nick!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
O.K thanks, i'm trying that now.
ASKER
Great, your advice worked first time....
Problem solved!
Thanks,
Nick!!!
Problem solved!
Thanks,
Nick!!!
Glad I could help.
Batalf
Batalf
then echo ur query and check...is that alrite ?
is till doesnt work ...
put this few lines after
$qid=....
if(!$qid){
echo 'Error :'.mysql_error();
}
and check the error...
Hope this helps..
LK