SitePoint Sponsor |
|
User Tag List
Results 26 to 48 of 48
-
Jan 6, 2006, 13:16 #26
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
-
Jan 6, 2006, 13:20 #27
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
-
Jan 6, 2006, 13:22 #28
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.
-
Jan 6, 2006, 15:41 #29
- Join Date
- Mar 2001
- Location
- Northwest Florida
- Posts
- 1,707
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
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
-
Jan 6, 2006, 15:45 #30
aaaaaaaaaaaaaaaaaaaaaahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
its working
!!!!!!!???????????????
wwoooooooooooooooooooooowwwaaaaaaa
-
Jan 6, 2006, 15:47 #31
$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
-
Jan 6, 2006, 15:48 #32
- Join Date
- Mar 2001
- Location
- Northwest Florida
- Posts
- 1,707
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
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
-
Jan 6, 2006, 15:49 #33
hahahahahhahahahah
by the way cool website you got there
specially the image gallery its simple thats what i like about it
-
Jan 6, 2006, 16:35 #34
- Join Date
- Aug 2004
- Location
- Manchester UK
- Posts
- 13,807
- Mentioned
- 158 Post(s)
- Tagged
- 3 Thread(s)
Just out of interest, do ANY $_GET requests work as expected?
eg:
PHP Code:<?php
if(isset($_GET['var'])) {
echo $var;
}
?>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?var=1">test</a>
-
Jan 6, 2006, 16:54 #35
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>
?
-
Jan 6, 2006, 16:56 #36
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>
-
Jan 6, 2006, 17:21 #37
- Join Date
- Mar 2001
- Location
- Northwest Florida
- Posts
- 1,707
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
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
-
Jan 6, 2006, 17:27 #38
after writing it to this
PHP 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
-
Jan 6, 2006, 17:28 #39
i dont get the code
-
Jan 6, 2006, 17:59 #40
- Join Date
- Mar 2001
- Location
- Northwest Florida
- Posts
- 1,707
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
if(isset($_GET['my_var'])) {
intragenesis, llc professional web & graphic design
-
Jan 6, 2006, 18:16 #41
when click the link the address bar change from
/tttt.php
to
/tttt.php?var=1
-
Jan 6, 2006, 19:18 #42
i go back to my Q
this is the code to display the categorys
getcategorys.php
PHP 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
PHP 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.
-
Jan 7, 2006, 19:04 #43
aahhhh
i give up at the moment
am starting with a book.
going to book shop today.
thanks any way guys.
-
Jan 7, 2006, 20:38 #44
- Join Date
- Mar 2001
- Location
- Northwest Florida
- Posts
- 1,707
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
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
-
Jan 8, 2006, 08:03 #45
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?
-
Jan 8, 2006, 08:10 #46
in php.ini what safe mode
there are few options to change
???
-
Jan 9, 2006, 05:35 #47
its working the bug is in the first code
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 />';
}
-
Jan 9, 2006, 05:49 #48
- Join Date
- Aug 2004
- Location
- Manchester UK
- Posts
- 13,807
- Mentioned
- 158 Post(s)
- Tagged
- 3 Thread(s)
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