Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 11th, 2005, 04:03 AM
Registered User
Join Date: Sep 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default help: register_global=off, I can not get URL

I set register_global=off in php.ini file, and I found my codes as
below does not work:
================================================== =================

$db = mysql_connect("localhost", "root", "949701");

if ($myid) {
   $result = mysql_query("SELECT * FROM teacher WHERE id=$myid",$db);
   $myrow = mysql_fetch_array($result);
   printf("name: %s\n<br>", $myrow["name"]);
   printf("address: %s\n<br>", $myrow["address"]);
   printf("year: %s\n<br>", $myrow["year"]);
    $result = mysql_query("SELECT * FROM teacher",$db);
    if ($myrow = mysql_fetch_array($result))
        do {
                printf("<a href=\"%s?$myid=%s\">%s %s</a><br>\n",$_SERVER['PHP_SELF'],
                $myrow["id"], $myrow["name"], $myrow["address"]);
            } while ($myrow = mysql_fetch_array($result));
        echo "sorry no records!";
================================================== ==================
The error is as below:
Notice: Undefined index: myid in D:\Apache Group\Apache2\htdocs\tt.php on line 6

I don't know how to define the variable "myid" when register_global=off. and my intention in my above code is to
get the related record through "myid".

Thanks in advance!

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
URL Redirect based on given URL somnath.kartic VS.NET 2002/2003 1 August 2nd, 2012 08:21 AM
URL rewriting with URL forwarding mtabyana BOOK: Professional Search Engine Optimization with PHP: A Dev's Guide to SEO ISBN: 978-0-470-10092-9 0 October 22nd, 2007 08:22 AM
URL MunishBhatia ASP.NET 2.0 Professional 4 May 11th, 2007 10:31 AM
extract URL from Favorites (.URL Files) PhilHawks VB.NET 2002/2003 Basics 2 November 2nd, 2004 04:35 AM
register_global "OFF" and extract command growch BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 6 November 7th, 2003 02:29 AM

All times are GMT -4. The time now is 07:04 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.