-
Posts
24,565 -
Joined
-
Last visited
-
Days Won
822
Everything posted by Barand
-
How to create query in log in that compares the id using php ?
Barand replied to aixen083's topic in PHP Coding Help
The id of the logged-in voter who wants to see the candidates in his/her organization. I have no idea how you are storing it and what your variable is but I thought that was a self-explanatory name for example purposes. -
No surprises there. If the username and password were wrong for mysqli then they will still be wrong for a PDO connection. You need to check the usernames and password on the server.
-
Your code "dies" if there is *not* an error! So you therefore echo "success" but the error gets displayed anyway Note: You can also specify the database with a 4th parameter in your connection.
-
How to create query in log in that compares the id using php ?
Barand replied to aixen083's topic in PHP Coding Help
Change it to ON c.org_id = v.org_id -
I would have thought the relation table redundant in this scenario. It look like a hierarchy +-------------+ | division | +-------------+ +------------+ | div_id |-----+ | team | | div_name | | +------------+ +------------+ +-------------+ | | team_id |-----+ | score | | | team_name | | +------------+ +-----<| div_id | | | score_id | +------------+ +-----<| team_id | | date | | score | +------------+
-
How to create query in log in that compares the id using php ?
Barand replied to aixen083's topic in PHP Coding Help
something like this SELECT c.firstname , c.lastname FROM candidates c INNER JOIN voters v USING (org_id) WHERE v.voters_id = $loggedInID -
Variable assignment: Curly braces inside question marks?
Barand replied to peterhuynh's topic in PHP Coding Help
or $message = "$nonce$token{$path}0.1buy965.45"; $path requires the {..} to prevent it being interpreted as $path0 which would be a valid variable name -
You can use the MySQL function STR_TO_DATE() to convert your dates to the correct format SELECT sale_date FROM `customer-sale` WHERE STR_TO_DATE(sale_date,'%d/%m/%Y') BETWEEN '2015-02-05' AND '2015-02-10' You can use that same function in an UPDATE query to convert your dates to the correct format. Add new DATE type column to store the correct format then UPDATE `customer-sale` SET newdate = STR_TO_DATE(sale_date, '%d/%m/%Y')
-
As you have been told by myself and mac_gyver, if an organisation has multiple courses, those courses would not go in the organisation table.
-
The set up you describes is the first in the three below. The one you probably want is the third ORGANISATION COURSE ------------ ------------ (MANY-to-ONE) org_id +----- course_id courses are org_name | course_name run by many org_description | organisations course_id >----+ ORGANISATION COURSE ------------ ------------ (ONE-to-MANY) org_id -----+ course_id organisations org_name | course_name run many org_description +----< org_id courses ORGANISATION ORG_COURSE COURSE (MANY-to-MANY) ------------ ------------ ----------- organisations run org_id ---+ id +--- course_id many course and org_name +-< org_id | course_name courses run by course_id >--+ many organisations
-
If you want to find overlapping dates then use a query like this SELECT a.room_id as rooma , a.start_date as starta , a.end_date as enda , b.room_id as roomb , b.start_date as startb , b.end_date as endb FROM book a INNER JOIN book b ON a.end_date > b.start_date AND a.start_date < b.end_date AND a.room_id < b.room_id
-
What is the code you have tried so far?
-
try $arr = json_decode('{"bids": [[ 100, 24 ], [ 300, 10 ], [ 200, 34 ]], "asks": [[ 300, 23 ], [ 100, 34 ], [ 200, 21]]}', 1); rsort($arr['bids']); sort($arr['asks']); echo '<pre>',print_r($arr, true),'</pre>';
-
Also, mysqli_fetch_array() will not execute the query.
-
You would do it in the function on return of the ajax response as you have been shown in reply #49 http://forums.phpfreaks.com/topic/294097-data-from-a-table/page-3?do=findComment&comment=1504950
-
That is javascript. Repeat to yourself several hundred times, or until it sinks in, "PHP runs on the server, javascript runs on the client"
-
A MySql type TIMESTAMP is not a unix-style timestamp but yyyy-mm-dd hh-ii-ss format. Try SELECT TIMESTAMPDIFF(MINUTE, event, NOW()) as time1 , dht22temp , humidity , pressure FROM sensordata WHERE event > NOW()-INTERVAL 2 HOUR ORDER BY Time
-
String values need to be inside single quotes in a query $select_u = mysql_query("SELECT * FROM `users` WHERE `city` = '$pilseta' ");
-
Your original code had the right parameters for mysqli but you forgot the "i" when you called the functions, using mysql_query() instead of mysqli_query() etc
-
function name must be a string? what function?
Barand replied to dhmyers82's topic in PHP Coding Help
Have a go at VB. You'll want to throw yourself out of the window- 4 replies
-
- 1
-
- fatal error
- function name
-
(and 1 more)
Tagged with:
-
function name must be a string? what function?
Barand replied to dhmyers82's topic in PHP Coding Help
This function $zodiacPictures($imgCounter) You need [..] for array indexes. (..) is for functions [edit] Using foreach() would be easier foreach ($zodiacPictures as $src){ echo '<img src="' . $src . '" />'; } and there are no </img> tags- 4 replies
-
- 1
-
- fatal error
- function name
-
(and 1 more)
Tagged with:
-
You need to GROUP BY city_name with that query
-
Is there a common key in both table to relate the records or do you want the same total to appear on every output row
-
By default, json_decode returns an object as you have done $obj=json_decode($result); So to access "low" you would use $low = $obj->low; If you want an array then you need the second argument of json_decode to be true EG $array = json_decode($result, 1); Then you can access low with $low = $array['low'];