Jump to content

bertrc

Members
  • Posts

    13
  • Joined

  • Last visited

bertrc's Achievements

Member

Member (2/5)

0

Reputation

  1. printf error line <?php mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); $mysqli = mysqli_connect("localhost", "root", "P-11fl32fg14", "cocoa"); $query = "SELECT type_chocolate.type_chocolate,type_chocolate.type_chocolate FROM type_chocolate"; $result = mysqli_query($mysqli, $query); /* numeric array */ while ($row = mysqli_fetch_array($result, MYSQLI_BOTH)) { printf("%s %s\n","<a href='cacau_type_chocolate.php?type_chocolate=" . $row['type_chocolate'] . ">,". $row['type_chocolate'] . "</a>");?> <br> <?php } ?>
  2. It is working thank you index.php <a href='cocoa_type_chocolate.php?type_chocolate=dark'>Dark</a> <a href='cocoa_type_chocolate.php?type_chocolate=milk'>Milk</a> <a href='cocoa_type_chocolate.php?type_chocolate=white'>White</a> cocoa_type_chocolate.php mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); $mysqli = mysqli_connect("localhost", "root", "*****", "cocoa"); $query = "SELECT chocolate.id_chocolate,chocolate.name_chocolate,type_chocolate.id_type_chocolate, type_chocolate.type_chocolate ,type_chocolate.id_chocolate FROM chocolate INNER JOIN type_chocolate ON chocolate.id_chocolate =type_chocolate.id_type_chocolate WHERE type_chocolate='$_GET[type_chocolate]'"; $result = mysqli_query($mysqli, $query); /* numeric array */ while ($row = mysqli_fetch_array($result, MYSQLI_BOTH)) { printf("%s %s %s %s %s\n", $row["id_chocolate"], $row["name_chocolate"], $row["id_type_chocolate"],$row["type_chocolate"],$row["id_chocolate"]); ?> <br> <?php } ?>
  3. I have two files index.php and cocoa_type_chocolate.php. I have 1 links is dark chocolate. I want one query when I press one link. I want to change the condition where, to change between 3 chocolates milk, dark, and white. in the condicion where I should use get. but I have problem with the url and where condicion. index.php <a href='cocoa_type_chocolate.php?type_chocolate=dark'>Dark</a> cocoa_type_chocolate.php mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); $mysqli = mysqli_connect("localhost", "root", "*****", "cocoa"); $query = "SELECT chocolate.id_chocolate,chocolate.name_chocolate,type_chocolate.id_type_chocolate, type_chocolate.type_chocolate ,type_chocolate.id_chocolate FROM chocolate INNER JOIN type_chocolate ON chocolate.id_chocolate =type_chocolate.id_type_chocolate WHERE type_chocolate='dark'"; $result = mysqli_query($mysqli, $query); /* numeric array */ while ($row = mysqli_fetch_array($result, MYSQLI_BOTH)) { printf("%s %s %s %s %s\n", $row["id_chocolate"], $row["name_chocolate"], $row["id_type_chocolate"],$row["type_chocolate"],$row["id_chocolate"]); ?> <br> <?php } ?>
  4. have two files index.php and cocoa_type_chocolate.php I have 1 links is dark chocolate. I want one query when I press one link index.php <a href='cocoa_type_chocolate.php?type_chocolate=dark'>Dark</a> cocoa_type_chocolate.php mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); $mysqli = mysqli_connect("localhost", "root", "*****", "cocoa"); $query = "SELECT chocolate.id_chocolate,chocolate.name_chocolate,type_chocolate.id_type_chocolate, type_chocolate.type_chocolate ,type_chocolate.id_chocolate FROM chocolate INNER JOIN type_chocolate ON chocolate.id_chocolate =type_chocolate.id_type_chocolate WHERE type_chocolate='dark'"; $result = mysqli_query($mysqli, $query); /* numeric array */ while ($row = mysqli_fetch_array($result, MYSQLI_BOTH)) { printf("%s %s %s %s %s\n", $row["id_chocolate"], $row["name_chocolate"], $row["id_type_chocolate"],$row["type_chocolate"],$row["id_chocolate"]);?> <br> <?php } ?> Edited 13 hours ago by bertrc
  5. I have two files index.php and cocoa_type_chocolate.php I have 1 links is dark chocolate. I want one query when I press one link index.php <a href='cocoa_type_chocolate.php?type_chocolate=dark'>Dark</a> cocoa_type_chocolate.php mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); $mysqli = mysqli_connect("localhost", "root", "*****", "cocoa"); $query = "SELECT chocolate.id_chocolate,chocolate.name_chocolate,type_chocolate.id_type_chocolate, type_chocolate.type_chocolate ,type_chocolate.id_chocolate FROM chocolate INNER JOIN type_chocolate ON chocolate.id_chocolate =type_chocolate.id_type_chocolate WHERE type_chocolate='dark'"; $result = mysqli_query($mysqli, $query); /* numeric array */ while ($row = mysqli_fetch_array($result, MYSQLI_BOTH)) { printf("%s %s %s %s %s\n", $row["id_chocolate"], $row["name_chocolate"], $row["id_type_chocolate"],$row["type_chocolate"],$row["id_chocolate"]);?> <br> <?php } ?>
  6. <?php mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); $mysqli = mysqli_connect("localhost", "root", "P-11fl32fg14", "cacau"); if (isset($_GET['tipus_xocolata'])) { $res = $mysqli->prepare("SELECT c.id_xocolata , c.nom_xocolata , t.id_tipus_xocolata , t.tipus_xocolata FROM xocolata c INNER JOIN tipus_xocolata t ON c.id_xocolata = t.id_tipus_xocolata WHERE tipus_xocolata = ? "); $res->bind_param('s', $_GET['tipus_xocolata']); $res->bid_result($id_xocolata, $nom_xocolata, $id_tipus_xocolata, $tipus_xocolata) ; echo '<pre>'; while ($res->fetch()) { printf("%s %s %s %s\n", $id_xocolata, $nom_xocolata, $id_tipus_xocolata, $tipus_xocolata); } echo '</pre>'; } ?> Parse error: syntax error, unexpected token "<", expecting end of file in /var/www/html/cacau/cacau_tipus_xocolata.php on line 6
  7. arse error: syntax error, unexpected token "<", expecting end of file in /var/www/html/cacao/cacao_type_chocolate.php on line 8 I am beginer with php and my english is not very good I am catalan I have one error, thank you How to put the get in the sentence where dark $query = "SELECT chocolate.id_chocolate,chocolate.name_chocolate,type_chocolate.id_type_chocolate, type_chocolate.type_chocolate ,type_chocolate.id_chocolate FROM chocolate INNER JOIN type_chocolate ON chocolate.id_chocolate =type_chocolate.id_type_chocolate WHERE type_chocolate='dark'"; don't know php oriented objects I have the database in catalan, I translate in english
  8. Parse error: syntax error, unexpected token "<", expecting end of file in /var/www/html/cacao/cacao_type_chocolate.php on line 8 I am beginer with php and my english is not very good I am catalan I have one error, thank you How to put the get in the sentence where dark $query = "SELECT xocolata.id_xocolata,xocolata.nom_xocolata,tipus_xocolata.id_tipus_xocolata, tipus_xocolata.tipus_xocolata ,tipus_xocolata.id_xocolata FROM xocolata INNER JOIN tipus_xocolata ON xocolata.id_xocolata =tipus_xocolata.id_tipus_xocolata WHERE tipus_xocolata='dark'"; I don't know php oriented objects I have the database in catalan, I translate in english
  9. I have two files index.php and cocoa_type_chocolate.php I have 3 links are dark, milk, white chocolate. I want one query when I press dark, another query when I press white, and another one when I press milk, but I don't know if I need to use if , else if else if. with method get or post index.php <a href="cocoa_type_chocolate.php?type_chocolate=dark">Dark</a> <a href="cocoa_type_chocolate.php?type_chocolate=white">White</a> <a href="cocoa_type_chocolate.php?type_chocolate=milk">Milk</a> cocoa_type_chocolate.php mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); $mysqli = mysqli_connect("localhost", "root", "P-11fl32fg14", "cocoa"); $query = "SELECT chocolate.id_chocolate,chocolate.name_chocolate,type_chocolate.id_type_chocolate, type_chocolate.type_chocolate ,type_chocolate.id_chocolate FROM chocolate INNER JOIN type_chocolate ON chocolate.id_chocolate =type_chocolate.id_type_chocolate WHERE type_chocolate='dark'"; $result = mysqli_query($mysqli, $query); /* numeric array */ while ($row = mysqli_fetch_array($result, MYSQLI_BOTH)) { printf("%s %s %s %s %s\n", $row["id_chocolate"], $row["name_chocolate"], $row["id_type_chocolate"],$row["type_chocolate"],$row["id_chocolate"]);?> <br> <?php } ?> mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); $mysqli = mysqli_connect("localhost", "root", "P-11fl32fg14", "cocoa"); $query = "SELECT chocolate.id_chocolate,chocolate.name_chocolate,type_chocolate.id_type_chocolate, type_chocolate.type_chocolate ,type_chocolate.id_chocolate FROM chocolate INNER JOIN type_chocolate ON chocolate.id_chocolate =type_chocolate.id_type_chocolate WHERE type_chocolate='milk'"; $result = mysqli_query($mysqli, $query); /* numeric array */ while ($row = mysqli_fetch_array($result, MYSQLI_BOTH)) { printf("%s %s %s %s %s\n", $row["id_chocolate"], $row["name_chocolate"], $row["id_type_chocolate"],$row["type_chocolate"],$row["id_chocolate"]);?> <br> <?php } ?> mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); $mysqli = mysqli_connect("localhost", "root", "P-11fl32fg14", "cocoa"); $query = "SELECT chocolate.id_chocolate,chocolate.name_chocolate,type_chocolate.id_type_chocolate, type_chocolate.type_chocolate ,type_chocolate.id_chocolate FROM chocolate INNER JOIN type_chocolate ON chocolate.id_chocolate =type_chocolate.id_type_chocolate WHERE type_chocolate='white'"; $result = mysqli_query($mysqli, $query); /* numeric array */ while ($row = mysqli_fetch_array($result, MYSQLI_BOTH)) { printf("%s %s %s %s %s\n", $row["id_chocolate"], $row["name_chocolate"], $row["id_type_chocolate"],$row["type_chocolate"],$row["id_chocolate"]);?> <br> <?php } ?>
  10. New Members 2 Posted just now I have two files index.php and cocoa_type_chocolate.php I have 3 links are dark, milk, white chocolate. I want one query when I press one link but I don't know if I need to use if , else if else if. index.php <a href="cocoa_type_chocolate.php?type_chocolate=dark">Dark</a> <a href="cocoa_type_chocolate.php?type_chocolate=white">White</a> <a href="cocoa_type_chocolate.php?type_chocolate=milk">Milk</a> cocoa_type_chocolate.php mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); $mysqli = mysqli_connect("localhost", "root", "*****", "cocoa"); $query = "SELECT chocolate.id_chocolate,chocolate.name_chocolate,type_chocolate.id_type_chocolate, type_chocolate.type_chocolate ,type_chocolate.id_chocolate FROM chocolate INNER JOIN type_chocolate ON chocolate.id_chocolate =type_chocolate.id_type_chocolate WHERE type_chocolate='dark'"; $result = mysqli_query($mysqli, $query); /* numeric array */ while ($row = mysqli_fetch_array($result, MYSQLI_BOTH)) { printf("%s %s %s %s %s\n", $row["id_chocolate"], $row["name_chocolate"], $row["id_type_chocolate"],$row["type_chocolate"],$row["id_chocolate"]);?> <br> <?php } ?> mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); $mysqli = mysqli_connect("localhost", "root", "*****", "cocoa"); $query = "SELECT chocolate.id_chocolate,chocolate.name_chocolate,type_chocolate.id_type_chocolate, type_chocolate.type_chocolate ,type_chocolate.id_chocolate FROM chocolate INNER JOIN type_chocolate ON chocolate.id_chocolate =type_chocolate.id_type_chocolate WHERE type_chocolate='milk'"; $result = mysqli_query($mysqli, $query); /* numeric array */ while ($row = mysqli_fetch_array($result, MYSQLI_BOTH)) { printf("%s %s %s %s %s\n", $row["id_chocolate"], $row["name_chocolate"], $row["id_type_chocolate"],$row["type_chocolate"],$row["id_chocolate"]);?> <br> <?php } ?> mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); $mysqli = mysqli_connect("localhost", "root", "*****", "cocoa"); $query = "SELECT chocolate.id_chocolate,chocolate.name_chocolate,type_chocolate.id_type_chocolate, type_chocolate.type_chocolate ,type_chocolate.id_chocolate FROM chocolate INNER JOIN type_chocolate ON chocolate.id_chocolate =type_chocolate.id_type_chocolate WHERE type_chocolate='white'"; $result = mysqli_query($mysqli, $query); /* numeric array */ while ($row = mysqli_fetch_array($result, MYSQLI_BOTH)) { printf("%s %s %s %s %s\n", $row["id_chocolate"], $row["name_chocolate"], $row["id_type_chocolate"],$row["type_chocolate"],$row["id_chocolate"]);?> <br> <?php } ?>
  11. I have two files index.php and cocoa_type_chocolate.php I have 3 links are dark, milk, white chocolate. I want one query when I press one link but I don't now if I need to use if , else if else if. index.php <a href="cocoa_type_chocolate.php?type_chocolate=dark">Dark</a> <a href="cocoa_type_chocolate.php?type_chocolate=white">White</a> <a href="cocoa_type_chocolate.php?type_chocolate=milk">Milk</a> cocoa_type_chocolate.php mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); $mysqli = mysqli_connect("localhost", "root", "*****", "cocoa"); $query = "SELECT chocolate.id_chocolate,chocolate.name_chocolate,type_chocolate.id_type_chocolate, type_chocolate.type_chocolate ,type_chocolate.id_chocolate FROM chocolate INNER JOIN type_chocolate ON chocolate.id_chocolate =type_chocolate.id_type_chocolate WHERE type_chocolate='dark'"; $result = mysqli_query($mysqli, $query); /* numeric array */ while ($row = mysqli_fetch_array($result, MYSQLI_BOTH)) { printf("%s %s %s %s %s\n", $row["id_chocolate"], $row["name_chocolate"], $row["id_type_chocolate"],$row["type_chocolate"],$row["id_chocolate"]);?> <br> <?php } ?> mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); $mysqli = mysqli_connect("localhost", "root", "*****", "cocoa"); $query = "SELECT chocolate.id_chocolate,chocolate.name_chocolate,type_chocolate.id_type_chocolate, type_chocolate.type_chocolate ,type_chocolate.id_chocolate FROM chocolate INNER JOIN type_chocolate ON chocolate.id_chocolate =type_chocolate.id_type_chocolate WHERE type_chocolate='milk'"; $result = mysqli_query($mysqli, $query); /* numeric array */ while ($row = mysqli_fetch_array($result, MYSQLI_BOTH)) { printf("%s %s %s %s %s\n", $row["id_chocolate"], $row["name_chocolate"], $row["id_type_chocolate"],$row["type_chocolate"],$row["id_chocolate"]);?> <br> <?php } ?> mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); $mysqli = mysqli_connect("localhost", "root", "*****", "cocoa"); $query = "SELECT chocolate.id_chocolate,chocolate.name_chocolate,type_chocolate.id_type_chocolate, type_chocolate.type_chocolate ,type_chocolate.id_chocolate FROM chocolate INNER JOIN type_chocolate ON chocolate.id_chocolate =type_chocolate.id_type_chocolate WHERE type_chocolate='white'"; $result = mysqli_query($mysqli, $query); /* numeric array */ while ($row = mysqli_fetch_array($result, MYSQLI_BOTH)) { printf("%s %s %s %s %s\n", $row["id_chocolate"], $row["name_chocolate"], $row["id_type_chocolate"],$row["type_chocolate"],$row["id_chocolate"]);?> <br> <?php } ?>
  12. Warning: Undefined array key "chocolate.id_chocolate" in /var/www/html/cocoa/cocoa_type_chocolate.php on line 17 Warning: Undefined array key "chocolate.name_chocolate" in /var/www/html/cocoa/cocoa_type_chocolate.php on line 17 Warning: Undefined array key "type_chocolate.id_type_chocolate" in /var/www/html/cocoa/cocoa_type_chocolate.php on line 17 Warning: Undefined array key "chocolate_chocolate.type__chocolate" in /var/www/html/cocoa/cocoa_type_chocolate.php on line 17 Warning: Undefined array key "type__chocolate.id_chocolate" in /var/www/html/cocoa/cocoa_type_chocolate.php on line 17 <?php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); $mysqli = mysqli_connect("localhost", "root", "P-11fl32fg14", "cocoa"); $query = "SELECT chocolate.id_chocolate,chocolate.name_chocolate,type_chocolate.id_type_chocolate, type_chocolate.type_chocolate ,type_chocolate.id_chocolate FROM chocolate INNER JOIN type_chocolate ON chocolate.id_chocolate =type_chocolate.id_type_chocolate WHERE type_chocolate='dark'"; $result = mysqli_query($mysqli, $query); /* numeric array */ while ($row = mysqli_fetch_array($result, MYSQLI_BOTH)) { printf("%s %s %s %s %s\n", $row["chocolate.id_chocolate"], $row["chocolate.name_chocolate"], $row["type_chocolate.id_type_chocolate"],$row["type_chocolate.type_chocolate"],$row["type_chocolate.id_chocolate"]);?> <br> <?php } ?>
×
×
  • 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.