Questions tagged as 'mysql'

6
answers

How to make a stopwatch continue counting after closing the page?

I need to create a timer that is started through a play , but I wanted a solution, other than just SESSION , to let even if the client closes the window or drops his internet, that is, it is not dependent on cache or front ....
asked by 08.05.2015 / 20:30
1
answer

SQL LIMIT parametrized in PHP with PDO

A few days ago, I stopped using the mysql_* functions (because they are already obsolete), and switched to PDO . I have a function that does query the database, but I'm having some problems using LIMIT with prepared statem...
asked by 23.02.2015 / 16:00
2
answers

Search with LIKE or MATCH..AGAINST in two columns

I have a classified system where I search with PHP and MySQL using LIKE in two fields: campo1 like '' or campo2 like '' The problem is when I look for something like "Green car" it does not display anything for "car" being contained i...
asked by 16.04.2014 / 20:26
2
answers

=, BINARY, LIKE, LIKE BINARY, REGEXP, SQL binary collation

Reformulation of the question from @GabrielHenrique's answer and search: What is binary collation in a string column in the table? BINARY serves to make a case-sensitive search and LIKE case-insensitive, then LIKE BINARY...
asked by 03.03.2018 / 14:48
2
answers

___ ___ erkimt Error in MySQL "expects parameter 1 to be resource, boolean given in" ______ qstntxt ___
%pre%

I have this code and can not see error in it, but it gives me this error. I know there should already be a topic of this on the site but I have tried all the ways and nothing. Give me the bool error (false)

    
______ azszpr28190 ___

This error happens when %code% or %code% fails, it is usually a syntax error in the sql query and returns a %code% as explained in manual . For mysql_fetch _ * () to function properly you must pass a variable of type %code% or %code% which is the return of %code% / %code% on success.

To fix the error you can force mysql_ * mysqli _ mysqli _ to display the database error with the mysql_error () or mysqli_error ()

Version with old mysql functions _ *

%pre%

Version with mysqli_ * procedural

%pre%

Version with mysqli_ * OO

%pre%

The query will return this error because %code% is a reserved mysql word.

  

Error Code: 1064. You have an error in your SQL syntax; check the   manual that corresponds to your MySQL server version for the right   syntax to use near 'desc'

The other way is to print the query and test directly at the database:

%pre%

Related:

Why should not we use functions of type mysql_ *?

MySQL vs PDO - which is the most recommended for to use?

How to print the SQL statement being sent to the bank?

    
______ azszpr333477 ___

The problem occurs because the %code% method needs a parameter with the connection to the database.

I leave an example below. Remember to modify the data to connect to the bank.

I leave it as a hint for you to study using the PDO because it is safer and the %code% is already depreciated.

  

Example:

%pre%     
___

$query = "Select * from servico where ID_SERVICO = $id"; $result = mysql_query($query); if($row = mysql_fetch_array($result)) { $nome = $row['NOME']; if($nome == 'Marketing') { include ("servicos/marketing.php"); }...
asked by 07.08.2014 / 19:13
2
answers

What is the question mark in a query?

Does%% use of a query really prevent SQL injection ? Avoid 100%? I saw this code and I heard lots of people talking about it, saying it helps in this case and how to use it? Could someone give a better example? $query = "SELECT * FROM tabel...
asked by 26.06.2014 / 23:18
1
answer

What is the purpose of the RESTRICT, CASCADE, SET NULL, and NO ACTION options?

When I'm going to create a foreign key type relationship between two tables in MySQL, I can specify some additional options in the ON UPDATE and ON DELETE events that are associated with the change and deleting records. The options are:...
asked by 09.06.2017 / 19:16
6
answers

How to create a password reset link?

I'm developing a site that has user registration area, the password is encrypted for increased security on the site, however when the user forgets the password how can I return the password from him unencrypted? I've seen a number of sites wh...
asked by 28.02.2014 / 18:07
2
answers

Difference between datetime x timestamp?

I am building a diagram in the MySQL Workbench and this question came to me, what is the difference between the two? I'm going to work with this base in Java, does java have a problem with any of them?     
asked by 26.02.2015 / 20:32
6
answers

Which database should I use in a small desktop application?

I read a little of Meta and I thought that this question does not go far from the current rules of the site. Risking losing reputation, come on: I currently work in a small company that currently manages very sensitive data (documents, addres...
asked by 28.02.2014 / 13:10