php-windows Digest 23 Oct 2004 02:21:28 -0000 Issue 2437

Topics (messages 24797 through 24798):

Re: MySQL Errors
        24797 by: Robert Schipper

Re: Post method not working
        24798 by: Zareef Ahmed

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
Hello Mikea.

You have to know that i am new to php, too. And i am also struggling to
understand the code. Well, i would suggest you take something
less complex to start up. But if you still want that code for the
beginning.. make sure the database xy (that part is missing in the
code) has a table ad_details and a table ad_cat_join. both also
have to contain some rows inside. otherwise $sql_countresult will be
false and you will get the errors, too.

Robert

Mikea wrote:
This is an applic that I got off the internet that I am trying to install.
An example of the code follows.

if ($action=="memberlist") {
 /* get the total number data and find out what the grand total is */
 $sql =  "select id, title, price from ad_details where member_id=" .
$_SESSION['login_id'];
 $sql .=" order by  $orderby $order LIMIT $limitvalue, $user_view_limit  ";
 $sqlcount = "select count(*) from ad_details where member_id=" .
$_SESSION['login_id'];
 } else {
 $sql =  "select a.id, a.title, a.price from ad_details a, ad_cat_join j
where j.cat_id=$current_cat_id ";
 $sql .="and a.id=j.ad_id order by $orderby $order LIMIT $limitvalue,
$user_view_limit";
 $sqlcount = "select count(*) from ad_details a, ad_cat_join j where
j.cat_id=$current_cat_id ";
 $sqlcount .=" and a.id=j.ad_id";
 }
 $sql_countresult = mysql_query($sqlcount);
 list($totalrows) = mysql_fetch_row($sql_countresult);


$res = mysql_query($sql); $num_ads = mysql_num_rows($res);

I did not code this and I'm struggling to understand the applic and PHP!  So
I'm up to my armpits in alligators! LOL

Thanks.

Mike



"Robert Schipper" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

hello mikea,

looks like there is something missing in your sourcecode, which you
should have provided. do you give any arguments to
mysql_fetch_array() ? Do you check if it is not false?

your code should look like this:

$sql = "SELECT * FROM example";
$result = mysql_query($sql,$db);

if ($result) {
 $myrow=mysql_fetch_array($result);
} else {
 echo "ERROR: SQL-query returned false!";
}

Robert

Mikea wrote:


I am getting the following errors when I execute a php script.

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL

result

resource
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL

result

resource
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
resource

What do I need to make this work? I am new to PHP. I read something

about

mysql.class.php somewhere. Do I need that somewhere? Do I put an

include

in the main script?  Where does mysql.class.php go directory-wise?

I am sure I am not giving enough information and may not be explaining

it

good enough.  My apologies.  Again, I am new at this.

I appreciate any help.  Thank you in advance.

Mike

--- End Message ---
--- Begin Message ---


-----Original Message-----
From: Janet Valade [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 21, 2004 2:05 PM
To: Brian; [EMAIL PROTECTED]
Subject: Re: [PHP-WIN] Post method not working

Brian wrote:

> OK, I'm new to php, so be gentle :)
> 
> I have just installed PHP 5.0.2 on Windows XP Pro\IIS 5
> 
> I am learning PHP with one of those step by step books, and I have run
into

Books you have with you are very old. Now  register globals are by
default off in PHP. You have to use $_GET array for GET method  or query
string and $_POST array for POST method. See your php.ini for more
details about register_globals

Zareef Ahmed.


> an issue with forms.  They don't seem to be getting the variable I am
> passing.
> 
> This code works:
> 
> <?
> $testvar = "this is a test";
> print $testvar;
> ?>
> 
> But this does not:
> 
> <?
> print "You chose a $borderStyle border";
> ?>
> 
> Even when I put 'filename.php?borderStyle=test' in the browser, with
the
> entire url of course, it still only shows the print text, but not the
> variable.
> 
> Any thoughts?  I have also verified that the mappings are set with
.php with
> verbs set to all or even GET, POST.

I'm not entirely sure what you are asking. But I think it might be that 
you need to use

$borderStyle = $_GET['borderStyle'];
print "You chose a $borderStyle border";

or for a posted form

$borderStyle = $_POST['borderStyle'];
print "You chose a $borderStyle border";

Janet


> 
> Thanks for any help
> 
> Belgarath the Ancient One
> 


-- 
Janet Valade -- janet.valade.com

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



------------------------------------------------------------------------
--
Zareef Ahmed :: A PHP develoepr in Delhi ( India )
Homepage :: http://www.zasaifi.com

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.778 / Virus Database: 525 - Release Date: 10/15/2004
 

--- End Message ---

Reply via email to