i have php web pages page ids such following example:
www.mysite.com/page.php?id=150 www.mysite.com/page.php?id=151 www.mysite.com/page.php?id=152
and on...
the mysql table having 2 columns field names , values, example:
id
= 150
email
= test@mysite.com
i able retrieve page id
of: echo $_get['id'];
how fetch email based on get
parameter? example www.mysite.com/page.php?id=150
echo email test@mysite.com
on page.php
.
okay, provided code need address column want data from.
<?php $id = (int)$_get['id']; $result = mysql_query("select email table_name id =$id"); while ($row = mysql_fetch_array($result)) { echo $row['email']; //$emails[] = $row['email']; or if want use them later store them. } ?>
you should update pdo
or mysqli
drivers. mysql_
out of date. can't handle prepared statements should using. prevent sql injections. i've cast user input integer here avoid injection hole.
Comments
Post a Comment