close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Problem with a simple search engine in MySQLi SB

Thread began 10/09/2018 10:37 am by María Luisa | Last modified 10/15/2018 9:33 am by general | 551 views | 1 replies |

María Luisa

Problem with a simple search engine in MySQLi SB

Hi!

I have a simple form that allows users to do searches such as registration number, or date ... things like that. Next the code of the form:

--
<form action="Result_Num_Matricula.php" method="get" name="F1">
<fieldset id="Search">
<input name="tmatricula" id="tmatricula"type="text" size="35" value=""<?php echo((isset($_GET["tmatricula"]))?$_GET["tmatricula"]:"") ?>>
<input type="submit" name="Buscar1" value="Buscar">
</fieldset>
</form>
--

"Result_Num_Matricula.php" is the page that processes the search and shows the results. I have this code:

--
<?php
$rsMatriculas = new WA_MySQLi_RS("rsMatriculas",$conexion,1);
$rsMatriculas->setQuery("SELECT * FROM matriculas WHERE matriculas.matriculas LIKE ? OR -1 = ? ORDER BY id DESC");
$rsMatriculas->bindParam("text", "".$_GET['tmatricula'] ."", "-1"); //tmatricula
$rsMatriculas->bindParam("text", "".$_GET['tmatricula'] ."", "-1"); //tematricula1
$rsMatriculas->execute();
?>
--

The question is that it behaves strangely when I try it: I enter a license plate number in the field "tmatricula" and it works but then I repeat again introducing another one and it stops working (it does not give results) ... I've been trying to solve it since yesterday and I can not find a way to do it.

Does anyone have an idea of ​​how it can work?



Thank you. regards

Sign in to reply to this post

María Luisa

Oh, wow... I found the solution

More than a day looking at the code without finding any error and I find it now that I just published in the forum.

I do not delete the post in case it could be of help to some other forum user.

The problem is in the second "bindParam" to which I put an "e" of more. The code on the results page should look like this:

--
<?php
$rsMatriculas = new WA_MySQLi_RS("rsMatriculas",$conexion,1);
$rsMatriculas->setQuery("SELECT * FROM matriculas WHERE matriculas.matriculas LIKE ? OR -1 = ?");
$rsMatriculas->bindParam("text", "".$_GET['tmatricula'] ."", "-1"); //tmatricula
$rsMatriculas->bindParam("text", "".$_GET['tmatricula'] ."", "-1"); //tmatricula1
$rsMatriculas->execute();
?>
--

Thank you very much.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...