Jump to content

SOLVED Building my Viewthread.php page on a forum


Fishcakes

Recommended Posts

SOLVED: I'm having trouble with an SQL  query via php in building my Viewthread.php file

So on the main page you have a list of the Threads and the link I created is like the below

<h2><a href='viewthread.php?id='{$row['id']}'>  {$row['Title']} </a></h2> Post {$row['id']}<br> 

If I set the query to an ID that exists the page loads fine

$query = mysqli_query($conn, "SELECT * FROM Threads where id='156'")

however if I set the id to the GET command the page doesn't load (which should've got the id)

$query = mysqli_query($conn, "SELECT * FROM Threads where id=$_GET['id']")

I tried casting this to a variable first too

$Number = "$_GET['id']"
$query = mysqli_query($conn, "SELECT * FROM Threads where id='$Number'")

 

Edited by Fishcakes
Link to comment
Share on other sites

  • Fishcakes changed the title to SOLVED Building my Viewthread.php page on a forum
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.