Jump to content

Recommended Posts

Ok, i would like to insert information from a Row, lets say row 1 ( SELECT * FROM `table` WHERE `id` = '1' ) and insert the data in a template, and it will have a url that will be something like index.php?page=1. How do i go by doing that?
and how would i go by doing that with every row that is created?
Link to comment
https://forums.phpfreaks.com/topic/3501-big-time-help/
Share on other sites

The answer to your first question is simply to retrieve the id value from the $_GET hash, then run the desired query (as per above) and substitute the appropriate id value. Once you have all the field values, do whatever you want with them in your template. And I don't understand your second question.
Link to comment
https://forums.phpfreaks.com/topic/3501-big-time-help/#findComment-12060
Share on other sites

ok lets say when i submit the form it makes and ID that equals 1 and the id will be inserted it to the url like: index.php?page=1, now when i click on that link, it wont do anything because it doesnt know where to connect to..... so how do i make the submit button that will grab a certain row information (like row 1 a.k.a ID 1) and display it on a template, and give it a name index.php?page=1
Link to comment
https://forums.phpfreaks.com/topic/3501-big-time-help/#findComment-12116
Share on other sites

Maybe I wasn't clear before -- on your index.php page, you check to see if a GET parameter was passed in PHP, and if so, query whatever table you desire. The submit button doesn't "do" anything but call your script with a parameter. Where did I lose you?
Link to comment
https://forums.phpfreaks.com/topic/3501-big-time-help/#findComment-12117
Share on other sites

ok, i think i found an easier way to do it, but it says "No rows found!"
here is my script:
[code]<?php
$page = $_GET[page];

// mysql variables
$host = "BLOCKED";
$user = "dbo154983898";
$pass = "BLOCKED";
$db = "db154983898";

// open connection
$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");

// select database
mysql_select_db($db) or die ("Unable to select database!");

// Grabs variable from url

// Setup mysql connection
$query = "SELECT * FROM 'reviews' WHERE 'id' = '$page' ";
$result = mysql_fetch_array($query);
// Then display the result as you wish
// see if any rows were returned

if (mysql_num_rows($result) > 0) {
// yes
// print them one after another
echo "$mysql_result[id]";
}
else {
// no
// print status message
echo "No rows found!";
}

// close connection
mysql_close($connection);

?>

[/code]

what did i do wrong?
Link to comment
https://forums.phpfreaks.com/topic/3501-big-time-help/#findComment-12120
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.