[Solved] How do I store whois result to MySQL [closed]

According to my understanding, if you want to save info with then take db structure as: whois_table { id (num)(pk) ip (varchar) info(long text) } Assume you have info like: http://www.whois.net/whois/facebook.com $ip = IP who’s whois info to be inserted $info = whois info of ip INSERT INTO whois_table (ip, info ) values ($ip, $info); … Read more

[Solved] How to get a particular cell from MySQL table using PHP? [closed]

<?php $conn = mysql_connect(‘localhost’, ‘mysql_user’, ‘mysql_password’); if (!$conn) { die(‘Could not connect: ‘ . mysql_error()); } mysql_select_db(‘database’); $result = mysql_query(‘select URL from table’); if (!$result) { die(‘Query failed: ‘ . mysql_error()); } echo mysql_result($result, 0); // outputs mysql_close($conn); ?> 0 solved How to get a particular cell from MySQL table using PHP? [closed]

[Solved] php mysql_fetch_array() error [duplicate]

when you run a DELETE command, I believe nothing is returned, thus you can’t mysql_fetch_array(). You would normally use that if you’re doing a SELECT. in this case, you’re deleting something, so just remove that loop, and echo(). solved php mysql_fetch_array() error [duplicate]

[Solved] How to make SQL Script like this? [closed]

You can try like following using GROUP BY and UNION ALL. select count(*) CT,Mark from TableName group by Mark union all select Count(*), ‘A+B’ as mark from TableName where mark in(‘A’,’B’) UNION ALL select Count(*), ‘A+C’ as mark from TableName where mark in(‘A’,’C’) union all select Count(*), ‘B+C’ as mark from TableName where mark in(‘B’,’C’) … Read more

[Solved] Please help querying for room’s availability [closed]

check this : http://sqlfiddle.com/#!2/d07965/20 Use this query. Only thing you are missing is equality condition. : select * from rooms A left join reservations B on A.id = B.room_id and B.reservation_date=”2014-01-11″ and B.start_period_id <= 11 and B.end_period_id >= 11 where B.room_id is null; Regards, Mansi solved Please help querying for room’s availability [closed]

[Solved] How can I execute an MySQL command through a shell script using if -else for condition based?

Mysql won’t understand if ..else shell syntax and so you will need to execute mysql within each if, else block with -e for execution e.g: … elseif [ “$(date +%m)” -eq 2 ] then mysql –login-path=local -e “use testdb;select COUNT(id) from xxx where app_id =’ABC’ and date(creation_date) between ‘$(date +%F -d “tomorrow -28 days”)’ and … Read more

[Solved] Could someone explain this php mysql script? [closed]

This question does not really belong here, but I’ll answer it for the sake of closing the question without bothering moderators. // mysql query is executed $images = mysql_query(“Select URL from images where Category = ‘Management’ “); // empty array initialized $imagerow = Array(); // while there are results of the executed mysql query while … Read more

[Solved] PHP If Statement with Multiple Conditions and Results

You can do this with either a switch statement or an elseif: if ($row[‘rank’] == 1 |){ echo ‘Administrator’; } elseif ($row[‘rank’] == 2){ echo ‘Moderador’; } elseif ($row[‘rank’] == 3) { echo ‘Helper’; }else{ echo “Not Ranked”; } OR switch ($row[‘rank’]) { case 1: echo ‘Administrator’; break; case 2: echo ‘Moderator’; break; case 3: … Read more

[Solved] Php and PDO – fetching data

The $data array contains multiple associative arrays (one for each record returned). If you want just the values for high for each record in one array and just the values for low in another the result set, you could do: <?php $high = array_column($data, ‘high’); $low = array_column($data, ‘low’); ?> 1 solved Php and PDO … Read more

[Solved] Django: how to get order_detail_data as per order_id

If you are using raw queries, then you just need to merge the data. Something like this should work, def merge_order_data_and_detail(orders, details): “””Group details by order_id and merge it in orders.””” # create dictionary key:order_id value:[order_detail_data] dic = {} for d in details: if d[‘order_id’] not in dic: dic[d[‘order_id’]] = [] dic[d[‘order_id’]].append(d) # iterate orders … Read more