Jump to content

Linking mysql database


aznjay

Recommended Posts

Creating a tutorial box:

 

if(isset($_GET['page']))

{

$query  = "SELECT * FROM phptut";

$result = mysql_query($query) or die('Error, query failed');

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

 

echo '

<div id="tutorial"><a href="index.php?page='.$row['id'].'">'.$row['title'].'</a> </div>';

echo '<br>';

}

 

 

}else{

 

$pagt = $_GET['page'];

$query  = "SELECT * FROM phptut WHERE id= '$page'";

$result = mysql_query($query) or die('Error, query failed');

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

 

echo $row['article'];

echo '<br>';

}

}

 

 

 

I tried using that, but the data from table PHPTUT does not show up........basically what i'm trying to do is when the table rows shows as links and when they click on the link it'll give specific data in that row. Can anyone help me recode? fix this?

 

Link to comment
Share on other sites

You mean error reporting? Sure.

 

Add:

ini_set('error_reporting', E_ALL);
ini_set('display_errors','On');  

 

at the very beginning of your script. Then we will see if there are any errors that prevent script from working as intended.

 

 

 

Link to comment
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.