Jump to content

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

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.