Jump to content

PHP Get and Vars...


rkomar

Recommended Posts

Hi,

 

I have some older php pages with the var in the url.

 

I have to have global register off or it does not work. I hope to receive some help here so I can turn globals off.

 

I have two pages main.php and main1.php

 

On main.php I have the url var like this:

 

a href="/mydirector/test101.php?JobID=<?php echo $JobID ?>

 

And on the second page main1.php I have this:

 

<?

$conn = mysql_connect("admin.mysite.com", "username", "password");

mysql_select_db("database",$conn);

$sql = "SELECT * FROM mysite WHERE JobID = '$JobID' ";

$result = mysql_query($sql);

$myrow = mysql_fetch_array($result);

?>

 

Any help in making this work is greatly appreciated.

 

 

Link to comment
https://forums.phpfreaks.com/topic/46260-php-get-and-vars/
Share on other sites

That worked great.  How about this one...

 

main.php    <a href="/mysite/search.php?PositionType=A new Position"

 

main1.php 

 

<?php

$conn = mysql_connect("admin.mysite.com", "username", "password");

mysql_select_db("database",$conn);

$result = mysql_query("SELECT Count(*) AS total FROM mysite WHERE PositionType='$PositionType' ");

$job_count = mysql_result($result, 0, 'total');

?>

 

Your reply worked great on the first one but it did not work here..

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/46260-php-get-and-vars/#findComment-225021
Share on other sites

It did not like this for a count:

 

$result = mysql_query("SELECT Count(*) AS total FROM mysitedb PositionType = '" . mysql_real_escape_string($_GET['PositionType']) . "'";

 

I have the other ones working.. just the count does not like what I have done.. nothing is displayed...

 

Thanks you for your time.

Link to comment
https://forums.phpfreaks.com/topic/46260-php-get-and-vars/#findComment-225103
Share on other sites

$result = mysql_query("SELECT Count(*) AS total FROM mysite WHERE PositionType='" . mysql_real_escape_string($_GET['PositionType']) . "'";

 

I got this in there but it is not working... just a blank page ...

 

I want to thank you for your help..

 

I got the other ones working and for some reason I just had a mental block and could not get what I was reading to work.

 

Thanks again.

Link to comment
https://forums.phpfreaks.com/topic/46260-php-get-and-vars/#findComment-225139
Share on other sites

Archived

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

×
×
  • Create New...

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.