Forum Moderators: coopster

Message Too Old, No Replies

Small PHP Problem, (Querystring)

         

rotfil

4:22 pm on Sep 16, 2006 (gmt 0)

10+ Year Member



I am trying to make a blog, and i can't work out in PHP how to copy something from a querystring, the word or brackets that you use..

i.e “’ strBlog_id ‘” or whatever it is in PHP

Here is the example with what I am trying to do, I just want blog_id number which is unique each time (already got that sorted) just to appear on the page.

http://www.example.co.uk/news/blogview.php?blog_id=1;

$query = "select * from contact where contact_blog_id=(strblog_id)";

Thanks for your help or guidance it sure would be helpful.
James

Psychopsia

4:28 pm on Sep 16, 2006 (gmt 0)

10+ Year Member



Hi!

You should use $_GET [us2.php.net] in this case.

$blog_id = intval($_GET['blog_id']);
$sql = "SELECT * FROM contact WHERE contact_blog_id = $blog_id";

Hope this helps.

rotfil

4:50 pm on Sep 16, 2006 (gmt 0)

10+ Year Member



Yes! it worked, i was really close before with something i had

$blog_id = $_GET['blog_id'];... However this works but there is still a problem, because I put that section of the PHP code in a separate page and then used the include function. So what i think i will need to do is just copy all the code to the main page, unless there is another way of doing it, but thanks for your help, its taken me quite a while to find that today.

Thanks James

rotfil

4:53 pm on Sep 16, 2006 (gmt 0)

10+ Year Member



yep done that, works a treat Thanks.