Correction of the PHP search code
Code:if(isset($_REQUEST["term"])){
Prepare a select statement
$sql = "SELECT * FROM products WHERE name LIKE ?“;
if($stmt = mysqli_prepare($link, $sql)){
Bind variables to the prepared statement as parameters
mysqli_stmt_bind_param ($stmt, “s”, $param_term)
Set of Parameters
$param_term = '%'.$_REQUEST["term"] .and %;
Attempt to execute the prepared statement
if(mysqli_stmt_execute($stmt)){
$result = mysqli_stmt_get_result ($stmt)
Check number of rows in the result set
if(mysqli_num_rows($result) > 0){
FETCH result rows as an associative array
while($row = mysqli_fetch_array($result, MYSQLI_ASSOC)){
$name = $row [name]
$photo = $row [‘photo’]
$id = $row [”id”]
$ali_url = $row [”ali_url”]
$cat = $row [”cat”]
$etsy_add = $row [”etsy_add”]
if($etsy_add==0) { $etsy_add_label = 'The goods are not added to Etsy'; }
Echo’
“$name”‘.$etsy_add_label’“$cat”“$ali_url”The View
‘;
The
by else{
Echo “No matches found”
The
by else{
“Error: Could not be able to execute $sql.“ .MySQL_error ($link )
The
The
Close statement
mysqli_stmt_close ($stmt)
The
The close connection
MySQL_close ($link )
-
567 3 0 Write help.
The error occurs because mysqli_prepare cannot prepare a sql request and returns false, and the mysqli_stmt_close function accepts a "prepared sql request", i.e. Examples of the class mysqli_stmt
In general, you need to rewrite a little logic of your code and then everything will work.
Current freelance projects in the category PHP
Create a WordPress plugin for a survey (quiz)
222 USD
A WordPress plugin needs to be developed that will be able to - store a bank of questions, all in the same format - a question and 4 answers, 1 correct - display 12 questions in random order, track the timing - collect user data - show the final result with the option to share… PHP, Web Programming ∙ 5 hours 8 minutes back ∙ 45 proposals |
Integration needed: KeyCRM → Cash Register KashalotIt is necessary to set up integration between KeyCRM and the Cash Register Kahalot. When placing an order in KeyCRM, the data must be automatically transmitted to Kahalot: • order information • products, nomenclature • prices • quantity More details in private. Content Management Systems, PHP ∙ 2 days 16 hours back ∙ 28 proposals |
Development of 2 SEO-oriented websites for selling spare parts (ATVs and special equipment)Development of Two Specialized Websites for Selling Spare PartsGeneral Information It is necessary to develop two specialized websites: Spare parts for ATVs, UTVs, SSVs, and other similar equipment. Spare parts for special equipment. Existing company website:… PHP, Web Programming ∙ 4 days 23 hours back ∙ 77 proposals |
Development of a WordPress website
22 USD
We are looking for a contractor to develop a custom website on WordPress for a jewelry store. The first stage will be a consultation. Content Management Systems, PHP ∙ 7 days 15 hours back ∙ 76 proposals |
Parser expireddomains.net
111 USD
A parser is needed for expireddomains.net. You need to log in to the site first; the problem is that it blocks the IP when trying to parse data. You need to parse thematic domains based on a list of keywords. If you are not confident in your abilities, please do not write. PHP, Web Programming ∙ 9 days 23 hours back ∙ 53 proposals |