I have the following query: and the output I am getting is: Resource id #2 Ultimately, I want to be able to echo out a single field like so: Without having to use a while loop, as since I am only trying to get one field I do not see the point. I have tried using mysql_result with no luck
MySQL commit and transaction
I have a question regarding MySQL commits and transactions. I have a couple of PHP statements that execute MySQL queries. Do I just say the following? What exactly would this do? How does it help? For updates, deletes and insertions I also found this to block other queries from reading: Would this block other…
MySQL INSERT IGNORE INTO keeps adding duplicate entries
Here’s the particular area im having an issue with when testing this it keeps adding the same entry to the table even though I have set IGNORE INTO. Answer It looks like you don’t have a UNIQUE INDEX on the IP column. In order for INSERT IGNORE to work as required, that’s neccessary. Try thi…
Check if all values in array are the same
I need to check if all values in an array equal the same thing. For example: If every value in the array equals ‘true’ then I want to echo ‘all true’. If any value in the array equals ‘false’ then I want to echo ‘some false’ Any idea on how I can do this? Answer…
How can I get PHP working again in the command line?
I’m completely at loss here and am about to wipe my hard drive clean and start from a fresh OS install. I’ve been trying for two days to create a new yii app in the terminal and have finally figured …
Track cursor movement of all the visitors on a web site
I know that there are many analytics tools available to track cursor movement of all the visitors on a website – these tools basically track the movement by giving a Javascript code which need to be pasted on the website. They all are quite expensive I am trying to develop it for my own website – …
How to use PHP with Visual Studio
First let me say I’ve never used PHP but I’m looking to learn it, so my question is this how do you use PHP within Visual Studio Ultimate? is it similar to how you declare JQuery i.e I’ve done multiple searches on Google, but I don’t get the answer I’m looking for. Or do I need a…
How to pass custom header to RESTful call?
There are some web service APIs that I need to connect to for my website. Most of the APIs involve something like this: But one web service requires the API key to be set in a custom HTTP header. How do I make the request to this API url and pass the custom header at the same time? Answer You
PDO were rows affected during execute statement
I have found many ways to use the exec statement for PDO, but I’m not sure it helps me. My understanding is that I have to use the execute() function for prepared statements. I am updating a row with data from user input, so I would like to use a prepared statement instead of the query() call. My code i…
Easy way to get Vimeo id from a vimeo url
I’m trying to get just the id from a vimeo URL. Is there a simpler way than this? All the vimeo video urls I see are always: https://vimeo.com/29474908 https://vimeo.com/38648446 // VIMEO $vimeo = …