Tag Archives: string

mysql_query() expects parameter 2 to be resource, string given in [duplicate]

Questions: Possible Duplicate: mysql_fetch_array() expects parameter 1 to be resource, boolean given in select what’s wrong with this line? 23. $result = mysql_query(“INSERT INTO $tbl_name(‘city_id’, ‘city’, ‘state_id’) VALUES(‘NULL, ‘.$city.”,”‘, ‘4421”) or die(mysql_error())”); I get this error message each time : Warning: mysql_query() expects parameter 2 to be resource, string given in line 23 This my… Read More »

Customize Url or Hide Query String using .htaccess

Questions: I am new one, I learn .htaccess. I want to customize my URL from index.php?page=mobile to index/page/mobile I used this code but it doesn’t work: RewriteEngine on RewriteRule ^index/([0-9]+)/?$ index.php?page=$1 [NC,L] # Handle product requests and RewriteEngine on RewriteRule ^index/([^/.]+)/?$ index.php?page=$1 [L] Answers:

Syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in PHP [closed]

Questions: mysql_connect(“localhost”,”root”,””); mysql_select_db(“hitnrunf_db”); $result=mysql_query(“select * from jos_users INTO OUTFILE ‘users.csv’ FIELDS ESCAPED BY ‘””‘ TERMINATED BY ‘,’ ENCLOSED BY ‘”‘ LINES TERMINATED BY ‘\n’ “); header(“Content-type: text/plain”); header(“Content-Disposition: attachment; filename=your_desired_name.xls”); header(“Content-Transfer-Encoding: binary”); header(“Pragma: no-cache”); header(“Expires: 0”); print “$header\n$data”; in the above code in query string i.e string in side mysql_quey we are getting following error… Read More »

Regex to check if exact string exists

Questions: I am looking for a way to check if an exact string match exists in another string using Regex or any better method suggested. I understand that you tell regex to match a space or any other non-word character at the beginning or end of a string. However, I don’t know exactly how to… Read More »

String to multidimensional array path

Questions: I have a multidimensional array, here is a small excerpt: Array ( [Albums] => Array ( [A Great Big World – Is There Anybody Out There] => Array(…), [ATB – Contact] => Array(…), ) [Pop] => Array (…) ) And I have a dynamic path: /albums/a_great_big_world_-_is_there_anybody_out_there What would be the best way to retrieve… Read More »

php $_SERVER['PHP_SELF'] to include query string

Questions: I’m essentially trying to make a login system that will return the user back to the page they were on. I know this question has been asked a bit, and I’ve looked at the other answers on SO, but I cannot find a solution to my particular problem. My site has has a table… Read More »

Read Json/Array string in Php

Questions: I have a string which is in valid Json format and it looks like this: { “message”: “success”, “result”: { “46620”: { “course_id”: “29”, “en_title”: “Google Analytics (Basic)”, “fa_title”: “مبانی Ú¯ÙˆÚ¯Ù„ آنالیتیکز”, “badge_link”: “http://www.darsnameh.com/badge/index.php?user=46620&badge=” }, “49449”: { “course_id”: “16”, “en_title”: “Multimedia Reporting 1- Reporting in the Internet Age”, “fa_title”: “گزارش‌گری چندرسانه‌ای Û±- گزارشگری در… Read More »