Jump to content

giannis196

Members
  • Content Count

    14
  • Joined

  • Last visited

Community Reputation

0 Neutral

About giannis196

  • Rank
    Newbie
  1. how i can make a php page that adds values to the database, and if the value already exist to delete it instead of add it? I am trying to do it but i am making a mistake and it only "deletes values". ``` <?php require("database.php"); if(empty($username) || empty($password)){ echo "error"; }else{ $cdtitle=$_POST["cds"]; $cdartist=$_POST["kal"]; $query= 'SELECT FROM cds WHERE cdtitle=:cdtitle && cdartist=:cdartist'; $result = $sql->prepare($query); $result->execute([":cdtitle" => $cdtitle, ":c
  2. Ok, i finally found it! here is the correct code: <?php require_once("database.php"); $select = $pdo->prepare("SELECT * FROM `carshopdatabase` "); $select->execute([]); $query = $select->fetchAll(); echo "<table id='previewCon'><thead><th>ID</th><th>car name</th><th>HP</th><th>CC</th><th>Drive Type</th><th>Required License</th><th>Cost</th><th>qty</th></thead><tbody>"; foreach($query as $k => $i){ $comment[$k]=$i["comm
  3. if you can tell me how i can select 1 level back then i think i have the solution. i will select (this) i will tell the machine to look 1 level back and then i will call find('#number'+itemid)
  4. yes, it's a button what do you mean with "directly target the element"? can you give me an example? edit: ok i understood what do you mean so i need to target the element in the same level (because what i am trying to select is in the same level with button) just like css's + but how i select an element in the same level in javascript? i edited the code and now it works only for the 1st item of the list, if i click to another item of the list it will not work, it will simply take the 1st input box here is the edited code: $('#previewCon tbody tr .addtocart').clic
  5. Ok so i am trying to make a shopping cart and now i must make jQuery to select the value of input number box so i made this script code: $('#previewCon tbody tr .addtocart').click(function(){ var itemid=$(this).attr('data-id'); var itemqty=$(this).find('#number').val(); alert(itemqty); }) The code suppose to select the pressed button and find the #number's number to add it to cart, unfortunately there is something wrong with the selector. can you help me out with that?
  6. so, i tried to built a webpage with html css jquery ajax javascript and php the entire page runs well and when i click to a vehicle to show the comment it shows well until i click to spare parts and then click again back to browse cars after that when i click to a car to show the comment the comment doesn't appear when i go to developer tools i notice that, for each car at the right it have got "event listener" and when i go to spare parts and back again to browse cars it haven't got event listener i think it's a problem with ajax and PHP... ...so, what's wrong with the code? the
  7. Hi everyone, i made a test webpage and i noticed the page is different between chrome and firefox and so i am here to ask if there is any way to ensure compatibility (both cross browser and cross device) without using any framework. Is there any "trick" to do that? So, what do you do to ensure the compatibility to webpages? Thanks! (btw i don't think i can post the page here because i have very limited bandwidth since i have the "free account") I am attaching 2 images, the 1 is from chrome and the other is from firefox So, why do i have this micro-difference?
  8. Ok, i found it! it couldn't found it because it was in the function that i wasn't run it yet!
  9. Hi everyone, so today i started writing a page in PHP until i got this error message: Notice: Undefined variable: query in C:\Users\Ioann\usbwebserver\root\carshop\index.php on line 19 The variable query is defined in functions.php and yet it still thinks it's undefined my functions.php <?php $host="localhost"; $username="root"; $password="usbw"; $dbname="test"; $pdo= new PDO("mysql:host=$host; dbname=$dbname", $username, $password, [PDO::MYSQL_ATTR_INIT_COMMAND =>"SET NAMES utf8"]); try{ } catch(PDOException $e){ echo "error please try again"; } function appearcars(){ $sel
  10. Ok guys i found it! i should put my query between `` SELECT * FROM `carshopdatabase ` is the correct query!
  11. Hi everyone, i am using mysql for database and when i am trying to run the query SELECT * FROM carshopdatabase i got the following error message: SELECT * FROM carshopdatabase LIMIT 0, 25 So, why is this happening and how do i fix it? Thanks!
  12. Hi everyone, i am trying to make a ajax page that’s fully crawl-able from search engine so search engines can find it but i need to know how i can insert the search bar’s value in to a variable so i can process it and make a script that will load with ajax the content: Here is the script that i make but i don’t know how i can fill the hpage (h for hash) with search bat value window.addEventListener("hashchange", function(){ var page=$(this).attr("data-id"); var hpage= $("#content").load("content/"+page); }) how i can insert the search bar’s value to the hpage? C
  13. ok i figured out what's wrong with the dropdown i had add a css style to the entire navbar i still have 2 more problems that i can't figure out: 1) the dropdown menu (at "Contact") adding space to the left as a result it's moving when someone hover the mouse over it 2) the Smenu that's at the left stills moving down when the dropdown menu opens here is my html code: <html> <head> <title>Website</title> <link rel="stylesheet" type="text/css" href="Style.css"> <meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta conten
  14. hi, yesterday i started to write code of a page for fun and i came across one problem. my dropdown menu takes the entire line + it push down the left menu (it's id is Smenu for "small menu") here is my html code: <html> <head> <title>Website</title> <link rel="stylesheet" type="text/css" href="Style.css"> <meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta content="utf-8" http-equiv="encoding"> </head> <body> <div> <ul class="navmenu"> <li><a href="#Home">Home
×
×
  • Create New...