Jump to content

gratsami

Members
  • Posts

    22
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

gratsami's Achievements

Member

Member (2/5)

0

Reputation

  1. First of all, Thanks for answers... For (rowCount()) I'v class For PDO and (rowCount()) is a function inside the class. when i select all records without where query / or with another where query it is work fine in my php code. but searching about plate_number isn't retrieve the records in php code. it is give 0 result. mmm, I want to ask can i use function inside the sql statement ONLY like str_replace to convert it from (f f f 5 5 5 5) to (f-f-f-5-5-5-5) and do the search on this style? regards,
  2. Because this is the rule in my country for vehicles plate numbers (three chars and four numbers spliced by spaces). Do you have any solution?
  3. Hi all, I'v table called vehicles with id (int auto_increment) and plate_number (varchar 150). the plate_number have records like (a a a 1 1 1 1) (b b b 2 2 2 2), three chars and four numbers spliced by spaces. I'v php search page with url like this: http://localhost/vehicles/show.php?plate_number=f%20f%20f%205%205%205%205 search about plate_numbet = f f f 5 5 5 5 my php code: // pdo connection. // first sql test $sql = "SELECT * FROM vehicles WHERE plate_number LIKE '%".$_GET['plate_number']."%'"; // second sql test // $sql = "SELECT * FROM vehicles WHERE plate_number = '".$_GET['plate_number']."'"; $db->query($sql); if($db->rowcount() > 0){ // print all results... }else{ echo "There are no results."; } The query result is: There are no results.. But, when I copy the sql statements into phpmyadmin it is works fine. (there is a result). like this: SELECT * FROM vehicles WHERE plate_number LIKE '%f f f 5 5 5 5%'; OR SELECT * FROM vehicles WHERE plate_number = 'f f f 5 5 5 5'; Also i used string functions (htmlspecialchars, rawurldecode, ... ), still not work. any suggestion to solve this issue? Thanks to all
  4. Hi, I've table called (rr) with 3 columns id int, name varchar 100, and cnt int. I wrote php code to loop each record depending on cnt: <?php $getAll = mysql_query("SELECT * FROM rr"); while ($v = mysql_fetch_array($getAll)){ for( $i=1; $i <= $v['cnt']; $i++ ){ echo $i ." - ". $v['name'] ." - ". $v['cnt'] . "<br />"; } } ?> I need to convert this code to MySQL command to get same result or creating a view with a same results. Can any body help me please? Thanks.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.