MySQL Forums
Forum List  »  PHP

Re: Confusion for newbie
Posted by: Peter Brawley
Date: July 23, 2017 02:21PM

> trim ($playername);

If you want the value from trime call, assign it ...

$playername = trim ($playername);

> $sqla = "SELECT firstname, lastname, home, age, bio FROM players
where lastname = $playername";

The value is a string, MySQL needs it quoted, '$playername'.

> $resulta = mysqli_query($conn, $sqla);

Always trap errors in API calls, at the very least ...

$resulta = mysqli_query($conn, $sqla) or exit( mysqli_error($conn) );

Options: ReplyQuote


Subject
Written By
Posted
July 23, 2017 02:10PM
Re: Confusion for newbie
July 23, 2017 02:21PM
July 23, 2017 06:26PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.