Tagged Questions
0
votes
0answers
22 views
PHP Grab User's Form Selection
Currently, I am grabbing a list from a database via an SQL statement and then injecting it into a drop down menu via php. However, now I need to tell which one the user selects from the list. Any easy ...
0
votes
1answer
35 views
How to use join in MySQL
In MySQL, I have two tables.
tasks
id
name
checklist
id
member_id
tasks_id
In the php page, I create the sql select string, I have a php variable that has a members_id value which is the ...
3
votes
1answer
31 views
PDO bindParam with $_POST not working
I've been searching and searching and trying all kinds of stuff and I just can't get this working right. Can anyone see what I'm doing wrong? I'm very new to PDO and trying to figure that out with ...
2
votes
3answers
35 views
Mysql Select and Fetch table data starting from specific value
This is an example of my table:
|..id.|.class...|.group....|..name....|
|..5..|....1....|.....A....|....XX....|
|.19..|....1....|.....B....|....XX....|
|.12..|....2....|.....A....|....XX....|
...
1
vote
1answer
11 views
Sqlite inner join not working :s
SELECT id, subject
FROM pages AS a
INNER JOIN articles AS b ON a.subject = b.id
WHERE a.id = ?
It doesn't work, it says:
General error: 1 ambiguous column name: id.
But I made an alias of ...
0
votes
0answers
21 views
jquery chained json remote not working correctly
I use jquery chained select by Mike Tuupola with json remote.
What is written in the documentation is this:
When change event of parent select is triggered GET request is sent to the given URL. ...
0
votes
2answers
28 views
SELECT id FROM table_name WHERE column = $variable
I'm trying to retrieve the id number of a record to use as a variable elsewhere. I only want the id from a record that has a particular value in another column. here is my code:
$result = ...
-1
votes
2answers
54 views
MYSQLi Select - PHP echo every query term occurrence within row
I have a table called pages that stores the id, url address, title, and content of webpages on my site. Here's an example of the table:
ID | address | title | ...
0
votes
1answer
32 views
How to set preselected options into a multiple select tag according to a php array
I have made a multiple select tag and I would like some of its options to be selected according to given PHP array $attr
<select multiple="multiple" name="isattr[]" id="editAttr">
<?php ...
2
votes
1answer
45 views
Multiple select tags into a PHP array
I have an input field repeated 3 times and would like to store the values entered for each of the fields in a PHP array. How would I achieve this? I called each OPTION item[] hoping that it will save ...
0
votes
0answers
71 views
PHP: dealing with form
I created a CMS where you can insert pages and sub pages.
For the pages everything allright. It's possible to insert name, content, visible (yes/no), position: selecting through the options obtained ...
0
votes
2answers
69 views
Check sum values in a select
I need a validation before submitting this form:
<form action="<?php echo $editFormAction; ?>" method="POST" id="form1" name="contract">
<table class="myp-table">
<tr>
...
1
vote
8answers
53 views
Select specific data from second table using output from first table
I have two table. One is account and the other is client table. The user will give input and in this case is 19. What I want to do is that I want to select ONLY a single name from client using ...
2
votes
1answer
69 views
Two dropdownmenus in one form
I have declared and loaded two dropdownmenus successfully in one form with a Submit input.
<form action="index.php" method="post">
<select name="sel1">
<?php //dynamically load options ...
-5
votes
3answers
46 views
Send selected value to PHP via Ajax [closed]
Is it possible to send $('#select option:selected').val() as part of the data in a $.ajax call? I know it's a numerical value, but I need it for DB purposes.
0
votes
3answers
31 views
How to search in more than one column of the database using cakephp
Good morning,
I need some help in a survey, which I am not able to do.
Imagine a web application (php), which makes use cakephp.
In this application I have a search field, one normal input.
And ...
1
vote
3answers
40 views
search those records which have column value with & in it
I have a problem in my website, I'm trying to fetch some data from a table that has courses names. I search by the name of that course. some of the names contain '&' in them, for example "Formal ...
0
votes
1answer
39 views
transfered data from a select to another and vice versa [duplicate]
I have 2 selects (a,b). Same data in both select.
I want that when I choose an option in one of them, the same option disapear in the second one. If a reselect an other option, the one tha disapeared ...
0
votes
0answers
40 views
Grup all and terminate total
I have next query:
SELECT COUNT(*) as 8day
FROM (
SELECT data_raport, SUM(ore) as Total_Hours
FROM sohy_works
WHERE data_raport BETWEEN '" . $_GET['data']."' AND '" . $_GET['data-2'] ...
2
votes
3answers
38 views
choose from a list <select> item and give it to the handler php
I use a <select> list that gets data from a database.
I need to choose from a list item and give it to the handler calc2.php
but it does not work, because the list between tags <? php?>
...
0
votes
2answers
33 views
saving mysql select in variable and using in if statement
I know this question has been indirectly explained, but I just cant seam to get it right. Im building a mathematical tool for teachers to create exercises, etc. The data base is populated by many ...
0
votes
0answers
25 views
WebMatrix Multi-select
Hello it is my first question here, so hope that i do it allright : )
I'm making a wirtual art gallery in WebMatrix. For now i spend 4 hours about thinking how to make, multi select as i called. I ...
3
votes
2answers
49 views
Show a string of images if present or default image if field empty
As always I'm having trouble with my PHP :( I'm still really new to this, I hope it gets easier eventually...
This is giving me a real headache, hope someone can help.
I'm trying to pull a string ...
-1
votes
1answer
55 views
COUNT, LIKE and EQUAL MySQL statement [closed]
How do I combined COUNT, LIKE and "EQUAL" in MySQL with PHP? I have the following query, is my "thinking" right. Or am I doing totaly wrong?
$query = 'SELECT COUNT(string)
AS
nums, ...
0
votes
1answer
71 views
I have to post select options on change with PHP, but select is being converted to ul li by JQuery
I am using styled select dropdown, from here:
I want to post the selected option in order to render some data for other dropdowns.
The problem is the the
onChange="this.form.submit()"
is not ...
0
votes
1answer
28 views
Pass values from db to form with php + json
I successfully select some values with php and sql, which are passed to my application with JSON.
([{"id":"1","email":"[email protected]","county":"world","age":"6","gender":"unisex","poll":"option1"}]);
...
-1
votes
2answers
43 views
SELECT $array[$id] in a mysql query
Now, I know this is bad practice but here is what i'm trying to do.
This is what I have now:
$max_str = "MAX(CASE WHEN p_list.p_name";
$case_str = "THEN (CASE WHEN check_box = '2' THEN '2' WHEN ...
0
votes
3answers
51 views
Filter search results if variables are not empty
I'm pretty new to PHP / MySQL .. so be easy on me please :)
I want to filter a 'SELECT' function where variables are '!empty'. Otherwise 'SELECT * FROM' database.
Here is my code..
<form ...
1
vote
1answer
27 views
How to insert into a table data and select from another table?
I want to do something like this:
My tb_b:
---------------
B | C // Columns
---------------
'y' | 'z' // row
---------------
EX: INSERT INTO tb_a(a,b,c) VALUES ('x',SELECT * from ...
-1
votes
0answers
23 views
select links from other users only
it's kinda confusing, how to get users link from db except my links that i submitted, for example user session can't view there own links.
exp:
$sql2 = mysql_query("select * from users Where ...
-1
votes
0answers
34 views
Multiple Between Statements Returning Error In PHP [duplicate]
I have a script for searching out members by area (Long / Lat) and I keep getting the old "Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given in" error message in the ...
2
votes
2answers
74 views
get selected month value in dropdown list if using an array
I am trying to get the selected value in the drop down; but the items inside it are in an array. How can I get the value of the selected option?
For now, I have these lines of code:
<?php
// ...
-6
votes
2answers
71 views
How to provide table name to select from a search text box like: SELECT * FROM $query [closed]
I cant find the answer anywhere, maybe someone could help me. I need to display my MySQL table, but I need to give the name of the table through search box.
Something like this:
$raw_results = ...
-3
votes
1answer
32 views
PHP Retrieve number of records in a select with limit [closed]
i am unable to retrieve the number of records in a select statement that contains a limit clause.
I am using the following:
select SQL_CALC_FOUND_ROWS id from item limit 6;
SELECT FOUND_ROWS() as ...
0
votes
2answers
50 views
PHP select distinct value of different row in the same table
I have a database with two columns:
1. city : amsterdam, rome, london, amsterdam, rome, new york, ...
2. type : red, green, blue, red, green, ...
I have to select from a database the distinct ...
0
votes
1answer
55 views
PHP MYSQL SELECT BETWEEN DATE'S
Hello i trying to select date from mysql between date's with this code:
if (empty($_GET['date-range1'])) {
$sql=mysql_query("SELECT * FROM sohy_raports ORDER BY ".$_GET['sort']." ...
0
votes
2answers
30 views
PHP MySQL - How do I obtain the id of the result of the last Insert statement without a second query?
How do I obtain the id of the result of the last Insert statement without a second query?
I am aware I could select the last row of the database to get what I'm looking for... sometimes. The issue is ...
0
votes
2answers
38 views
Fetching a result from selection query in php function
I have a php function of selection from mySql database:
function Master_file($name, $latin ){
$HOST_DB ="localhost";
$NAME_DB="nom";
$USER_DB ="utilisaeur";
$PWD_DB="K3Pud1";
$connect = ...
2
votes
3answers
54 views
Counting/Grouping with MySQL
Is it possible to return all rows that belong to a group with less than 3 rows using just SQL or do I have to use some PHP to get this result?
For example consider this table
___________________
| ...
0
votes
3answers
41 views
How to hide an item when today is not between 2 given dates?
I want to hide the items in a selectbox when the date is not between 2 given dates.
For example: startdate is 5th of may and enddate is 16th of may. If today is the 10th then the item can be shown. ...
0
votes
1answer
49 views
MYSQL supplied argument is not a valid MySQL-Link resource [duplicate]
ERROR:
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /var/www/247QC/system/core.php on line 21
Invalid query: Whole query: SELECT * FROM users WHERE username='matt' ...
0
votes
1answer
45 views
How do I make a SQL Command with INSERT AND COUNT
I don't know how to COUNT a column named id. I tried
mysql_query("INSERT INTO `servers` (`user_id`, `ip`, `port`, `banner`, `disabled`, `vip`,`premium`, `name`, `status`, `votifier_key`, ...
0
votes
0answers
53 views
Php foreach loop concatenation
I am working on a script to loop over what check boxes a user clicks on, depending on which ones were clicked that will result in a "dynamic" query. I am trying to build a where statement with a array ...
3
votes
1answer
85 views
PHP/MYSQL: Slowly iterate through 6k rows and for every row create new records - Algorithm
I'm sorry for stupid question, but I have one of these days, where I feel like the dumbest programmer. I need your help. I'm currently developing with PHP and MYSQL, where I'm like super low skilled ...
0
votes
2answers
28 views
PHP - How to echo selected option on page when the user selects an option and is updated on change?
I have a foreach statement on my Select menu to generate options on my list. I need a why to pull the selected option to the page and tell the user what they are currently selecting.
Here is my code:
...
1
vote
2answers
29 views
Generate form based on form selection
I have a dropdown selection box to generate another select box based on the selection of the first box. I have put an example below.
<form action="" method="type">
<select ...
1
vote
2answers
40 views
I need the closest smaller value in mysql table
I'm making experience points based rank system for my mmorpg. Let's say I have 2 tables,
table1: username - exp
table2: rankname - exp
each rank require a specific amount of exp to get promoted ...
0
votes
1answer
56 views
Dropdown onchange does not change value for second dropdown [closed]
I'm learning Javascript and trying to do the following:
In my first dropdown I want to show all the continents.
In my second dropdown I want to show all the countries.
For example:
First dropdown:
...
2
votes
1answer
45 views
joining records from 3 tables
i tried to join records from two tables which have the following schema
users
----
name
phone
email
sales
----
seller_id
buyer_id
amt
date
here is my sql
Select
sales.amt,
sales.date,
...
0
votes
0answers
58 views
MySQL SELECT into Fieldset .. each Row = Another Fieldset
Have a user submitting a form
http://bootply.com/61703
Posting the entries to a single MySQL table on a button submit
Where each input = a column of one row..
And would like to load another page ...