/    Sign up×
Community /Pin to ProfileBookmark

mysql_fetch_array(): doesn’t work???

on the page below i get the error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/mariannetrafikkskole/www/omoss.php on line 5

[URL=http://www.mariannetrafikkskole.no/omoss.php]http://www.mariannetrafikkskole.no/omoss.php[/URL]

This is the code i used:

[code=php]
$resultat = mysql_query(“SELECT * FROM kontakt”);
while ($rad = mysql_fetch_array($resultat) ) {
$tekst = $rad[‘tekst’];
}
[/code]

does anybody know what is wrong with:
mysql_fetch_array(); ??

is it php5 code or something…?
it works fine locally on php5 and apache 2
but the place where i get the error i think use older versions…
what can i use instead of mysql_fetch_array(); ??

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@chazzyApr 26.2006 — do this

[code=php] $resultat = mysql_query("SELECT * FROM kontakt") or die("Unable to issue query: ".mysql_error());
while ($rad = mysql_fetch_array($resultat) ) {
$tekst = $rad['tekst'];
}
[/code]

You should always check that your queries work.
Copy linkTweet thisAlerts:
@demiurgenauthorApr 26.2006 — SUPER!

it was the name of the database that was different from the name i used locally.

THANKS!
×

Success!

Help @demiurgen spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...