Jump to content

Not sure why...


SkyRanger

Recommended Posts

Ok, not sure what the problem is but here is the code:

 

Page with link:
<A HREF="rinfo.php?pid=1"><img src="images/info.gif" alt="feature info" border="0" width="12" height="12" /></a>

Going to:

// Make a MySQL Connection
mysql_connect("localhost", "username", "passwrd") or die(mysql_error());
mysql_select_db("dbase") or die(mysql_error());


$result = mysql_query("SELECT * FROM pop where pid='$pid'") <- Doesn't work
but when i put in: $result = mysql_query("SELECT * FROM pop where pid='1'") <- This works
or die(mysql_error());
while($row = mysql_fetch_array($result)) {

echo "<strong>".$row['ptitle']."</strong>";
echo "<br><br>";
echo nl2br($row['pdesc']);
echo "<br><br>";
}

 

All I am getting is a white page.

 

Even when I put in the echo $pid; nothing shows

 

When I put in echo "Some test"; This works.

Link to comment
https://forums.phpfreaks.com/topic/98572-not-sure-why/
Share on other sites

link

<A HREF="rinfo.php?pid=1"><img src="images/info.gif" alt="feature info" border="0" width="12" height="12" /></a>

 

<?php

mysql_connect("localhost", "username", "passwrd") or die(mysql_error());
mysql_select_db("dbase") or die(mysql_error());


$sql = "SELECT * FROM pop where pid=' ".$_GET['pid']."' ";

$sql_result=mysql-query($sql)or die(mysql_error());

while($row = mysql_fetch_array($result)) {

echo "<strong>".$row['ptitle']."</strong>";
echo "<br><br>";
echo nl2br($row['pdesc']);
echo "<br><br>";
}
?>

Link to comment
https://forums.phpfreaks.com/topic/98572-not-sure-why/#findComment-504597
Share on other sites

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.