Questions tagged as 'mysqli'

2
answers

How to differentiate data from two tables with columns of equal names in a SQL request with JOIN?

I've combined two tables with JOIN , the two tables have some columns with the same names ... When extracting data with PHP how will I differentiate? Example : foreach($dados as $values){ echo $values['price'];...
asked by 07.12.2016 / 12:26
2
answers

Converting two MySQL selects to one

I have a small question about MySQL. I have the following MySQL query: sq1 = mysqli($conexao,"select * from tabela1"); $tr1 = mysqli_num_rows($sq1); Then I make the famous loop: for ($i=0;$i<$tr1;$i++) { $registro1 = mysqli_fetch_a...
asked by 31.07.2016 / 16:56
2
answers

MySQLi vs PDO - query execution / functions

Looking at questions here from the stack and the php.net site, I saw that the query / function runs in MySQLi uses if() to check whether it was executed or not, and PDO uses try { ... } cacth() { ... } , example connection to bank ac...
asked by 03.03.2018 / 06:25
1
answer

Sort results with month and year

I have a table with the mes E ano fields. How can I sort results by month? I am already ordering by the year = > SELECT * FROM tabela WHERE id_cliente = '$id_cliente' ORDER BY ano DESC Now how can I order the months too...
asked by 11.07.2017 / 15:44
3
answers

Ask before deleting bank data

I have this code: <?php if ($result = $mysqli->query("SELECT * FROM usuario ORDER BY id")) { if ($result->num_rows > 0) { echo "<table border='1' cellpadding='5' cellspacing=0 style=border-collapse:...
asked by 23.09.2014 / 20:22
1
answer

PHP - Mysqli correct way

I'm starting to use mysqli in my projects, however I've seen two ways to make a connection: One of them is simple and equal to mysql_connect $db = mysqli_connect(...); I saw in w3schools. Another is $db = new mysqli('local...
asked by 25.06.2016 / 19:19
2
answers

mysqli_select_db () expects parameter 1 to be mysqli, string given [duplicate]

I have a problem here with Mysql, it is giving errors, I have made all kinds of changes. I have tried to change the Mysql function to Mysqli and only increase errors. Code: <?php $sql["host"] = "localhost"; $sql["usuario"] = "ro...
asked by 29.10.2017 / 14:41
1
answer

perform sum of values codeiginiter

I need to add some values to the end of a table as shown below: HerearethecodesI'musing:Controller:functionindex(){$this->template->set('title','ListadeOrçamentos');$config=array("base_url" => base_url('orcamentos/p'), "per...
asked by 05.06.2017 / 15:15
2
answers

No select error with PHP + MySQLi

I'm trying to use a query to pull a specific ID from another page. I can get ID through $_GET , I printed the query to see if it was right, even though it did not show me what error it was. Code: <?php $mys...
asked by 31.05.2016 / 06:21
2
answers

how to use Order by enum

Hi, I want to know how to use ORDER BY to do the following in my SQL table column category module I have a ENUM with the following 'media','filme','ova' modes I'd like to make an application to sort as follows in the code be...
asked by 23.10.2015 / 05:53