http://localhost/home/test.php?category_id=731
thats what shown in address bar
but it still show the categoryid is not set
about the php.ini
its set to
post_max_size = 8M
| SitePoint Sponsor |
http://localhost/home/test.php?category_id=731
thats what shown in address bar
but it still show the categoryid is not set
about the php.ini
its set to
post_max_size = 8M
i think all move to diffrent side first what i mean is
all create the database and the admin panel
then all go to the way to display them
coz this problem is educating about the php
but i need to move with the development untel i fine a way to solve this problem
may be there is diffrent method to do a product catelog
thanks though guys
by the way do you think its ok to install php.exe and add the extentions latter
or shall i install the manual instulation.?
am reading more about mysqli
i think it should be used from now own
as they clam its more secured method for database connectivity.





Hi, I uploaded the following script on my server here : http://www.ngcomputing.com/test.php
Code:<title>$_POST test</title><?php $category_id = $_GET['category_id']; if($category_id){ echo "category_id : $category_id <br><br>"; } else { echo "category_id is not set...<br><br>"; } $some_value = rand(1,999); echo "<a href=\"test.php?category_id=$some_value\">click here to set category_id to $some_value</a>"; ?>
intragenesis, llc professional web & graphic design
aaaaaaaaaaaaaaaaaaaaaahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
its working
!!!!!!!???????????????
wwoooooooooooooooooooooowwwaaaaaaa
$category_id = $_GET['category_id'];
i see you added this variable
now its the bigger headach how am gouing to implimanted in my
product category.
thanks man thumbs up





Originally Posted by hisham777
Now take the code above and run it on your server. If it doesn't work, then again, it is a problem with either your PHP 5 or IIS setup.
intragenesis, llc professional web & graphic design
hahahahahhahahahah
by the way cool website you got there
specially the image gallery its simple thats what i like about it![]()


Just out of interest, do ANY $_GET requests work as expected?
eg:
Try thatPHP Code:<?php
if(isset($_GET['var'])) {
echo $var;
}
?>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?var=1">test</a>
i added the code directly
first execution state this
<body>
<a href="/home/tttt.php?var=1">test</a>
</body>
when i click the link test
i get this
<body>
<br />
<b>Notice</b>: Undefined variable: var in <b>D:\home\tttt.php</b> on line <b>11</b><br />
<a href="/home/tttt.php?var=1">test</a>
</body>
?
when i work with code inself page it works fine
like add records to the table
her is the code i got from Zend website
using mysqli
<head>
<basefont face="Arial">
</head>
<body>
<?php
if (!isset($_POST['submit'])) {
// form not submitted
?>
<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
Category ID:
<input type="text" name="country">
Category Name:
<input type="text" name="animal">
<input type="submit" name="submit">
</form>
<?php
}
else {
// form submitted
// set server access variables
$host = "";
$user = "";
$pass = "";
$db = "joke";
// get form input
// check to make sure it's all there
// escape input values for greater safety
$country = empty($_POST['country']) ? die ("ERROR: Enter a country") : mysql_escape_string($_POST['country']);
$animal = empty($_POST['animal']) ? die ("ERROR: Enter an animal") : mysql_escape_string($_POST['animal']);
// open connection
$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
// select database
mysql_select_db($db) or die ("Unable to select database!");
// create query
$query = "INSERT INTO category (category_id, category) VALUES ('$country', '$animal')";
// execute query
$result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());
// print message with ID of inserted record
if ($result) {
echo "New record inserted with ID ".mysql_insert_id();
}
// close connection
mysql_close($connection);
}
?>
</body>
</html>





replace occurances of var with my_var
( var is a reserved word, the poster intended on you to replace it with your own variable name )
intragenesis, llc professional web & graphic design
after writing it to this
when i click testPHP Code:<?php
if(isset($_GET['var'])) {
echo $var;
}
?>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?my_var=1">test</a>
i get test
and the address bar shows
/tttt.php?my_var=1
??
i get this in the address bar
i dont get the code





if(isset($_GET['my_var'])) {
intragenesis, llc professional web & graphic design
when click the link the address bar change from
/tttt.php
to
/tttt.php?var=1
this is the code to display the categorys
getcategorys.php
and it works fine i thinkPHP Code:<?php
$conn = mysql_connect("", "", "");
if (!$conn) {
echo "Unable to connect to DB: " . mysql_error();
exit;
}
if (!mysql_select_db("joke")) {
echo "Unable to select mydbname: " . mysql_error();
exit;
}
$sql = "SELECT category, category_id
FROM category";
$result = mysql_query($sql);
if (!$result) {
echo "Could not successfully run query ($sql) from DB: " . mysql_error();
exit;
}
if (mysql_num_rows($result) == 0) {
echo "No rows found, nothing to print so am exiting";
exit;
}
while ($row = mysql_fetch_assoc($result)) {
echo '<a href="displaypage3.php?category_id='
. '">'
. $row['category_id']
. '</a>'
. ' '
. $row['category']
. '<br />';
//echo '<a href="displaypage.php?category=' .'">' .$row['category'] .$row['category'] .'</a><br />';
}
mysql_free_result($result);
?>
it display the the category ID with a link and the Category
when the link clicked should fatch the records from table products
and display the products with that category
the idea was to make it fatch
the name of the product
the product pic
the product discreption
the code (with a help of holmescreek and spikeZ thank you guys) to fatch the product discription is
after executing it display'sPHP Code:<?php
$conn = mysql_connect("", "", "");
if (!$conn) {
echo "Unable to connect to DB: " . mysql_error();
exit;
}
if (!mysql_select_db("joke")) {
echo "Unable to select mydbname: " . mysql_error();
exit;
}
$category_id = $_GET['category_id'];
$sql = "select * from products where category_id = ". $category_id;
// --- debug
echo "category_id : $category_id" . "<br>";
echo "sql statement : $sql";
exit;
// --- end debug
$query = mysql_query($sql) or die(mysql_error());
while($rows = mysql_fetch_assoc($query)) {
echo $rows['description'] .'<br />';
}
?>
category_id :
sql statement : select * from products where category_id =
no notes no warnings or error. !
so far it seams that the getcategorys.php is not passing the variable i think.
![]()
aahhhh
i give up at the moment
am starting with a book.
going to book shop today.
thanks any way guys.





It's not the code, it's a problem with your php and/or IIS configuration. Remeber, I posted the code on my site and it worked, setting category_id, and gave you the exact code that was running.
Keep your head up. If programming was easy, prostitutes would still make more money per hour.
intragenesis, llc professional web & graphic design
hi homescreek
the code you gave me that pass the category_id it works on my server
but when i execute the code above why its not taking the category_id and quirying the quiry ????
still dont understand the problem
and if i happen to fine the problem one day i think its a very simple one
its just cant be notised.
any way holmescreek if you dont mind me asking
how do you estimate the charges for a service you give to you client
like building a website for them?
in php.ini what safe mode
there are few options to change
???
its working the bug is in the first code
any comments or suggesting are apriciated on how to make the code better.PHP Code:while ($row = mysql_fetch_assoc($result))
{
echo '<a href="displaypage3.php?category_id= . $row['category_id'] .'">'
. $row['category_id'] . ' '
. $row['category_name'] . '</a><br />';
}


PHP Code:while ($row = mysql_fetch_assoc($result))
{
echo '<a href="displaypage3.php?category_id=' . $row['category_id'] .'">'
. $row['category_id'] . ' '
. $row['category_name'] . '</a><br />';
}
Bookmarks