Jump to content

Archived

This topic is now archived and is closed to further replies.

DaveLinger

Notice: Undefined index: AND Notice: Undefined variable:

Recommended Posts

I'm getting both of these errors now that I've switched to a new server. The code it doesn't like is...

[code]
<?php
if($_GET['page'] == ''){
$id="index";
}else{
$id = $_GET['page'];
}
?>
[/code]

Share this post


Link to post
Share on other sites
That should work
A little tip to make it cleaner

$id = isset($_GET["page"]) ? $_GET["page"] : "index";

try usin the isset();

Share this post


Link to post
Share on other sites
what about for something like this?

[code]
if($id == ''){
$query="SELECT *, DATE_FORMAT(Date, '%W, %M %D %Y') AS my_date FROM wg_pages WHERE id=\"$id2\" ORDER BY datetime DESC";
}else{
$query="SELECT *, DATE_FORMAT(Date, '%W, %M %D %Y') AS my_date FROM wg_pages WHERE id=\"$id\" ORDER BY datetime DESC";
}[/code]

Share this post


Link to post
Share on other sites

×

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.