-
Posts
422 -
Joined
-
Last visited
-
Days Won
1
Everything posted by awjudd
-
Do you have indexes on either of the tables? I would also suggest against using the ANSI JOINs (,) and move to using INNER JOINs because you will not be CROSS JOINing your dataset. SELECT pd.product_id, pd.product_name, pp.sales_price_inc_vat, ptc.* FROM product_data pd JOIN product_pricing pp ON pd.product_id = pp.product_id JOIN products_to_categories ptc ON pp.product_id = ptc.product_id ~awjudd
-
1 day 7 hours ... time is ticking! gogogogogogo
-
Echo the up_for value: echo $arr [ 'server_info' ] [ 'up_for' ]; You would use one of the string functions (i.e. http://php.net/manual/en/function.date.php) to convert the time to a readable time. ~juddster
-
You need to use the period (.) to concatenate strings not the plus sign (+). ~juddster
-
// Assuming $arr is your array name (the one you are print_r'ing). echo 'Players: ', implode(',', $arr['players']); This will emit all of the players in a CSV. ~juddster
-
There is no shorthand. You need to split it out. ~juddster
-
Yes you do. Anything from the user should be sanitized. ~juddster
-
I think you are missing a / in front of the path in readfile. As it stands right now, it is looking in a subdirectory for a var/www/vhosts... when I think you actually want it to be from /var/www .... And how is $name populated, you never said in your post. If you echo the actual path you are passing into readfile, is it the file you expect? ~juddster
-
Are you sending in a query parameter called "userinput"? If you aren't then your script is looking for that (i.e. $_GET['userinput'] looks there). Side Note: You should be careful and sanitize your input because someone could SQL inject you there. ~juddster
-
inserting value from one form field to various columns
awjudd replied to MsKazza's topic in MySQL Help
This seems to be a JavaScript related question and not a mysql one. You will need to just bind to the onchange event and update all of the other fields which correspond to the gender to say the same value. ~juddster -
Notice: Undefined index: option in on a isset
awjudd replied to mrooks1984's topic in PHP Coding Help
It is happening because the $_GET variable 'option' doesn't exist (i.e. it is not in your query string). You can resolve this by doing something like ... $option = ''; if ( isset ( $_GET [ 'option' ] ) ) { $option = $_GET['option']; } That said, this is a fairly big security risk leaving it open like this ... ~juddster -
@Drummin - Oh God no! CROSS JOINing each of the tables for this is a bad idea. As well, you will get an ambiguous column error if you do that because $field is in all of them (not to mention your code is very susceptible to SQL injection). // Validate the field type $availableFields = array ( 'postcode', 'location', 'company_name' ); if ( ! ( in_array ( $_POST [ 'field' ], $availableFields ) ) { die ( 'Invalid Field Selected.' ); } $field = $_POST [ 'field' ]; $var = mysql_real_escape_string ( $_POST [ 'var' ] ); $query = 'SELECT 'freeuser' AS usertype, id, company_name, location, postcode FROM freelistings WHERE ' . $field . ' LIKE \'%' . $var . '%\' UNION ALL SELECT 'basicuser' AS usertype, id, company_name, location, postcode FROM basicpackage WHERE ' . $field . ' LIKE \'%' . $var . '%\' UNION ALL SELECT 'premiumuser' AS usertype, id, company_name, location, postcode FROM premiumuser WHERE ' . $field . ' LIKE \'%' . $var . '%\''; That said, I have to agree with everyone else who suggests against using multiple tables to store this information. It just plain old doesn't make sense. ~judda
-
SELECT `tbl_a`.* AS A, `tbl_b`.* AS B FROM `tbl_a`,`tbl_b` WHERE B.`status`<> 'YES' OR B.`status` IS NULL; ~juddster
-
I'm guessing you want to order the letters stored in a text field in the database. Is this correct? If yes, the fields aren't meant to work that way. ~juddster
-
SELECT userid, birthday FROM users WHERE birthday BETWEEN DATE_ADD(CURDATE(), INTERVAL 30 YEAR) AND DATE_ADD(CURDATE(), INTERVAL 18 YEAR) ~juddster
-
Please provide us with your current query. ~juddster
-
If in your login script you have $_SESSION['username']=$username; then anywhere else in the application (assuming you called session_start()) you can access it through $_SESSION['username']. ~juddster
-
Yes, that is an assignment and if it is on a page that doesn't have $username defined then it will clear the value. ~juddster
-
I would assume that would be the default reaction of many people given that the account name is "debian system maintenance" ... pulling at straws here ... but seems important ~juddster
-
If applications made stuff, then don't delete it. You should only mess around with stuff you created yourself. They weren't created for no apparent reason. The phpmyadmin one was created so you can have the bookmarking and stuff that is built into phpmyadmin. ~juddster
-
By defining that variable? $displaySuccessMsg = NULL; Or by checking if it is set before using it? if(isset($displaySuccessMsg) { echo $displaySuccessMsg; } ~juddster
-
ERROR when Exporting SQL table in Excel 97-2003 Format
awjudd replied to kamal213's topic in MySQL Help
Your table is likely huge, so you would need to expand the amount of allowable memory for PHP. ~juddster -
Build the date of birth from the current date and the birthday that the user provided. Then use something like this: http://stackoverflow.com/questions/327429/whats-the-best-way-to-calculate-date-difference-in-javascript to calculate the difference between the two. ~juddster
-
Does your $query variable's query return any results? i.e. if you throw it into phpmyadmin then do you see the user id and usernames? I disagree with Ivan's suggestion of using the {} I personally prefer if I'm doing it that way either string concatenation or using sprintf. $sql2 = sprintf ( "INSERT INTO mailbox VALUES ( '', 'locked', '', '%s', '', NOW(), '', 'locked', '')", mysql_real_escape_string ( $_POST [ 'username' ] ) ); You are adding in lots of empty strings could those not be NULL? ~juddster