Jump to content

Isset1988

Members
  • Posts

    51
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Isset1988's Achievements

Member

Member (2/5)

0

Reputation

  1. thank you for your help. i mean ide not framework.
  2. Hello! I have two questions for you. Until now, i programmed php with a text editor. Someone, tell me that i'm silly. He use a framework, which help him write clean code, with new php functions. He said me that when my code deprecated, this framework help me (suggest me) replace these specific functions with the new one. Is there any framework to do this? And what framework you proposed me to use? Furthermore, i want to build a php marketplace. I dont want to use any free or paid template - code. What php must use for security? I see in wordpress and joomla code that programmers use pdo. What's your opinion? Thank you my friends!
  3. I underastand, the only thing i want is to retrieve at least one row correctly. Any way... Thank u my friend!
  4. I attached here the thread table. Ca you take a look? Thank you!
  5. Thank you for your help. I tried that localhost. I use the first command on my phpmyadmin and done. When i tried retrieve data, i get the same ungly code. Can i post here the thread table to take a look? Thank you!
  6. Hello all I have a vb mysql database and its collation is "latin_swedish_ci". (i have huge problem on searching greek chars) I'm trying to create a php script to retrieve some data's from a specific table. For example: header('Content-type: text/html; charset=UTF-8'); $connection = mysql_connect('localhost', 'root', ''); mysql_select_db('database', $connection); mysql_query("SET NAMES 'utf8'", $connection); $query = 'SELECT title FROM thread WHERE threadid = 15'; $result = mysql_query($query, $connection); $result = mysql_fetch_assoc($result); print_r($result); But i get code like this: Σκιάθος - ΚουκουναÏιέ In my phpmyadmin i get the same code. The english chars shows perfect. From now, i want to retrieve some data's from the above tables on utf8. Any idea? Thank you! (If i can retrieve the data's correctly, i will create a new table - mirror of the old table as utf8 and i hope my problem fixed that way)
  7. Any idea? Is there any other way to update the quantities and the total price using javascript?
  8. Hello I have two issues with a javascript cart. When i change the quantities, i see updated the total and the subtotal, but ... when i load the page, the total and subtotal is empty by default. Can i print above the subtotal and the total-quantity? Here i attach you my code: <script> var books = {} window.onload=function() { var inputs = document.getElementsByTagName('input'); for (var i=0;i<inputs.length;i++) { if (inputs[i].type=="text" && inputs[i].id.indexOf('quantity')!=-1) { var name = inputs[i].id.replace('quantity',''); books[name] = parseFloat(document.getElementById(name+'price').innerHTML.replace('$','')) inputs[i].onkeyup=function() { var total = 0; for (var book in books) { var q = document.getElementById(book+"quantity").value; total += (isNaN(q) || q=="")?0:parseInt(q)*books[book] } document.getElementById('subtotal').innerHTML="Sub-total: "+total.toFixed(2)+" €"; document.getElementById('grandtotal').innerHTML="Total: "+(total*1.23).toFixed(2)+" €"; } } } } </script> <p id="1price">100 €</p> <input type="text" id="1quantity" value='1' /> <p id="2price">100 €</p> <input type="text" id="2quantity" value='1' /> <div class="total-subtotal"> <p class="totals" id="subtotal">Sub-total:</p> </div> <div class="total-price"> <p class="totals" id="grandtotal">Grand-total:</p> </div> Is there someone who can help? Thank U!
  9. Thank you for your answer requinix. The proper/valid html is: <ul> <li> <a href='#'> Category </a> <ul> <li><a href='#'> Sub Category </a></li> </ul> </li> </ul> Is there any solution without have the subcategory nside the category?
  10. Update all cart quantities... I share it if someone wants to use it with the code above. Front page: (i have it into a while loop. in this way i push things into an array) <input type="text" name="<?='qty'.$key?>" value="<?=$value?>"> The session file: //condition update all If(isset($_POST['update'])){ foreach ($_POST as $key=>$value) { //first i save the post data to an array if (stristr($key,'qty')) { $id = str_replace('qty','',$key); $_SESSION["cart"][$id] = $value; //save the array into my cart session } } }
  11. Hello my friends, I want to create a vertical menu with some categories and some subcategories. My script produses a little strange the unordered list structure. (there is no way to change this) <ul> <li> <a href="#"> Category 1 </a> </li> <li> <a href="#"> Category 2 </a> </li> <ul> <li> <a href="#"> SubCategory 2.1 </a> </li> </ul> <ul> <li> <a href="#"> SubCategory 2.2 </a> </li> </ul> <li> <a href="#"> Category 3 </a> </li> </ul> Can someone help me to create a simple css 3 menu. Thank you !
  12. I'm sorry. I read again your answer carefully. I expand the session script following your logic structure. This is what i need. I post it there if anyone want to copy this. <?php session_start(); if(!isset($_SESSION["cart"])){ // create cart if it doesn't exist $_SESSION["cart"] = array(); } $add2cart = isset($_GET["add2cart"]) ? (int)trim($_GET["add2cart"]) : 0; // condition input if($add2cart > 0){ // a valid value //$query = "select COUNT(*) from products where id=$add2cart"; // run the query using your favorite database library functions, check for errors, and retrieve the COUNT value $count = 1; //i bypass this to check the sessions if($count==0){ echo 'the product is not in our database'; // it is usually cleaner/clearer to handle the error condition up front in the logic } else { if(!isset($_SESSION["cart"][$add2cart])){ // check if id is not already in cart $_SESSION["cart"][$add2cart] = 1; // create item in cart } else { $_SESSION["cart"][$add2cart]++; // increment item in cart } } } $remove = isset($_GET["remove"]) ? (int)trim($_GET["remove"]) : 0; // condition delete if($remove > 0){ unset($_SESSION["cart"][$remove]); } $removeAll = isset($_GET["removeAll"]); // condition delete all if($removeAll > 0){ unset($_SESSION["cart"]); } $update = isset($_GET["update"]) ? (int)trim($_GET["update"]) : 0; // condition update $quantity = isset($_GET["quantity"]) ? (int)trim($_GET["quantity"]) : 0; if($update > 0 && $quantity > 0){ $_SESSION["cart"][$update] = $quantity; } //condition update all ? // display raw cart data for debugging purposes echo '<pre>',print_r($_SESSION['cart'],true),'</pre>'; ?> Now the only function i need to find is to update all the cart quantities with one click. :/ Thank you for your help mac_gyver!
  13. Thank you for your help. But i have to handle and ids in order to proceed an order.
×
×
  • 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.