Jump to content

bbmak

Members
  • Content Count

    50
  • Joined

  • Last visited

Community Reputation

0 Neutral

About bbmak

  • Rank
    Regular Member

Profile Information

  • Gender
    Not Telling
  1. anyway to fix that? I tried it without an array. It works fine with google chrome.
  2. I try to addslashes to an array $_POST form. The code works fine, and it updates the database. However, google chrome gives me an error. Not sure anyone know how to fix this. I am writing a block of java script into database as text. Code below: echo '<form name="misc_settings" action="?action=misc_settings_submit" method="POST" enctype="multipart/form-data">'; foreach($miscsettings as $miscsetting){ $misc_id = $miscsetting['id']; $misc_name = $miscsetting['name']; $misc_text = stripslashes($miscsetting['text']); echo '<input type="hidden" name="misc_id[]" value="' .
  3. After I added the div tab, the AJAX sub-menu is not working anymore. I am stuck here for whole day. <div class="tab"> <button class="tablinks" onclick="openProgram(event, 'add_item')" id="defaultOpen">Add Item</button> <button class="tablinks" onclick="openProgram(event, 'list_item')">List Items</button> </div> <!--------------------------------------------------------------------------------------------------------------------------------> <div id="add_item" class="tabcontent"> <div id="list_item" class="tabcontent"> ... //not worki
  4. Hi, New to PDO, stucked on binding params in the dynamic query. $searchTerms = explode(' ', $search_string); foreach ($searchTerms as $searchTerm){ $condition .= "ci.item_name LIKE ':searchTerm' OR "; } $condition = substr($condition, 0, -4); $searchQuery = "(SELECT ci.id, ci.item_name, ci.item_description FROM core_item ci WHERE " . $condition . ")"; if($searchStmt = $this->pdo->prepare($searchQuery)) { foreach ($searchTerms as $key => $value){ $seachTerms->bindParam($key, '%' . $value . '%'); } $searchStmt->execute(); return
  5. I think it is personal perference... I used #2, and I like the { } vertical allign
  6. Can you show an example of dynamic binding in PDO? I planned to move PDO in future, but I stayed with mysqli for now. I have to rewrite my functions and classes in pdo. I may switch to hybrid mode though.
  7. Hi, How do you split a search string by space and put it into a prepare query? $strings = $_POST['strings']; $string_array = explode(" ", $strings); $search = $mysqli->prepare(" SELECT * FROM core_table where item_name in ( ? ) "); $search->bind_param("s", $string_array); ...
  8. Thanks This seems even better than putting a case when statement in the query for my case.
  9. Instead of writing 2 separated query, are there anyway to put a case statement when in the where clause of the query? $category_id will be null if on front page and not null on category pages. So, I want to put a statement on the highlighted part. However, it seems not working. Can someone help with my syntax. case when $category_id is Null THEN "" when $category_id is not Null THEN ci.cat_id = ? function next24($category_id, $lastItemID) { if(!empty($lastItemID)) { if($next24item = $this->mysqli->prepare(" SELECT ci.id as item_id, ci.cat_id
  10. thanks, got it echo '<li><a href="#" onclick="openLink(\'item.php?merchant_id=' . $cat_id . '\')">' . $cat_name . '</a></li>';
  11. Hi Having problem with putting ' in to my link . this is what i want on the link <li><a href="#" onclick="openLink('item.php?merchant_id=x')>Category 1</a></li> this is my mess echo '<li><a href="#" onclick="openLink('''; ?>item.php?merchant_id=<? echo $cat_id . ''')">' . $cat_name . '</a></li>'; & try this echo '<li><a href="#" onclick="openLink('''item.php?merchant_id=' . $cat_id . ''')">' . $cat_name . '</a></li>';
  12. Hi, 1. I got my code working, but not sure this is the proper way to return an array from a prepare statement. 2. when I use bind_result($var), are there anyway to include all columns without typing them all? if($next24item = $this->mysqli->prepare("SELECT ci.id as item_id, ci.item_name, ci.item_description, ci.item_note, ci.item_price, ci.item_discount, ci.item_url, ci.date_created, ci.date_updated, ci.date_expired, cii.item_id as cii_item_id, cii.item_image_filename, cm.merchant_
×
×
  • 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.