PHP can't $_GET value
Posted: Wed Aug 10, 2011 6:19 am
Hey there guys!
I got a little problem.
I tried to create a real time page with connection to mysql db and grab data in real time but, the query depends of $_GET, function that my file can't preform, what other ways are to get values ?
Here is the example code:
Index.php:
<head>
<script src='js/jQuery.js' type='text/javascript' />
</head>
<div class='viewdata'>
</div>
<script src='js/js_view_data.js' type='text/javascript' />
Js_view_data.js:
$.ajaxSetup({
cache: false;
});
$(setInterval(function() {
$(".viewdata").load("viewdata.php");
$(".viewdata").attr({ scrollTop: $(".viewdata").attr("scrollHeight") });
}, 500));
Viewdata.php:
Now, the problem is that index.php is the one who can $_GET , so any $_GET in placed in this file will be 0.
Can anyone help me?
I got a little problem.
I tried to create a real time page with connection to mysql db and grab data in real time but, the query depends of $_GET, function that my file can't preform, what other ways are to get values ?
Here is the example code:
Index.php:
<head>
<script src='js/jQuery.js' type='text/javascript' />
</head>
<div class='viewdata'>
</div>
<script src='js/js_view_data.js' type='text/javascript' />
Js_view_data.js:
$.ajaxSetup({
cache: false;
});
$(setInterval(function() {
$(".viewdata").load("viewdata.php");
$(".viewdata").attr({ scrollTop: $(".viewdata").attr("scrollHeight") });
}, 500));
Viewdata.php:
Code: Select all
mysql_connect("blabla", "blabla", "blabla");
mysql_select_db("somedb");
$id = $_GET['id'];
$query = mysql_query("SELECT whateverdamnthing FROM whatevertable WHERE id = '$id' ");
while($row = mysql_fetch_array($query)){
echo $row['whatever'];
}Now, the problem is that index.php is the one who can $_GET , so any $_GET in placed in this file will be 0.
Can anyone help me?