Questions tagged as 'php'

3
answers

Use a variable for the LIMIT in a SELECT of MYSQL with PHP

I need to do a SELECT in PHP where X records are randomly selected. So I'm using the ORDER BY RAND() method, but I need the LIMIT to be one or the other depending on a variable, that is, something like this: $sql = "SELECT...
asked by 16.11.2018 / 20:20
2
answers

Query works but PHP does not return the values

Hello, I am making a request to searchRand.php, in the php I make a query to obtain data. And I save it in the $ to_return variable. But when returning the value of $ to_return does not return anything. Being in the php command print the variabl...
asked by 15.11.2018 / 10:42
3
answers

Take sql data and mark it as active or current

I want to do this in php maybe I can not explain myself well so if you need to modify it do not worry I can do it quickly since I feel in my pc I have a table with only 2 variables (ACTIVE) and (NOT ACTIVE) $sql = mssql("select estado from...
asked by 26.01.2017 / 12:52
3
answers

How to go through an arrangement that is sent from php to Javascript

Well doing this ajax that I send to a processing form which returns an Array that brings parameters and an array of names I will leave here my example of php code; This is an array of names which I fill with a for that I do $nombre[]= $nuev...
asked by 02.03.2018 / 01:01
1
answer

Problem with date in mysql query

I have a problem with a rebellious date. It turns out that I have to make a query between two dates, which would be this: SELECT id FROM 'Pedidos' WHERE ('fecha_cobro' BETWEEN '$fechini' AND '$fechafin') AND borrado = 0 I come from a form t...
asked by 01.12.2017 / 11:25
3
answers

Print array in php

I have the following array, how can I print it in an orderly way? Array ( [return] => Array ( [0] => Array ( [codigo_materia] => 3525 [desc_materia] => Aprender Biologia [id] => 1 [nombre_materia] => Biologia ) [1] => Arra...
asked by 18.04.2018 / 22:26
2
answers

Error Mysqli mysqli_query () expects parameter 1 to be mysqli, even if I am already giving you the two parameters that you request [duplicated]

I have this code: <?php require ("../clases/Conexion.php"); session_start(); $host = "localhost:3307"; $user = "root"; $pass = ""; $bd = "nutricion"; $con = mysqli_connect($host,$user,...
asked by 18.04.2018 / 19:52
1
answer

Count and show number of records that meet a condition

Good, as it would be the correct way to know and show the number of records in a table that meet a certain condition. I have tried with the following to show the number of records without any condition but it shows nothing. <?php $sq...
asked by 27.01.2018 / 10:51
1
answer

enable and disable fields

I am finishing a project and would like to see how to enable and disable a text field depending on the radiobutton that the user selects. I already found a code in the forum and it is what I want only that my questionnaire is filled with an a...
asked by 20.02.2018 / 16:40
2
answers

Show Alert or message after a header? PHP

I was creating a insert , and when I sent the data I got an alert message saying that the data had been inserted successfully, but now, the page goes blank and only shows that alert. What I did to keep it from getting stuck was to redir...
asked by 09.08.2017 / 21:43