I was wondering if the code below is the correct way to use mysqli_real_escape_string() when storing users data in a database.
Here is the PHP & MySQL code.
if (mysqli_num_rows($dbc) == 0) {
$mysqli = mysqli_connect("localhost", "root", "", "sitename");
$dbc = mysqli_query($mysqli,"INSERT INTO info (user_id, url)
...
We are building an ajax application in which a users input is submitted for processing to a php script. We are currently writing every request to a log file for tracking. I would like to move this tracking into a database table but I do not want to run a insert statement after request. What I would like to do is set up a 'queue' of trans...
I need to read a file in PHP, but I only know the end of the filename, so I need to serch the file in a given directory using wildcards: *filename.wav and then return it to the browser.
Is there a function to do that? or I need to get all the files in the directory and then search one by one?
Thanks for all the comments and help.
...
Is there a difference between javascript cookies and php cookies?
...
I have an application where I need to INSERT an auto_increment value from a PK in another table. I know how to do this in PHP, but I need to have this done at the DB level, since I cannot change the program logic.
I am new to triggers, so I'm sure this will be an easy answer for someone. Here is what I have so far:
DELIMITER //
...
I'm using shell_exec() to execute a Twitter API Call.
shell_exec('curl -u user:password -d "id=3191321" http://api.twitter.com/1/twitterapi/twitterlist/members.xml');
That works fine when I authenticate correctly and put in a number for the id.
But when I try to put in a variable ($id), it screws up.
$addtolist = shell_exec('curl ...
I'm using smarty for my site, and I'm trying to loop through an array to print out table rows...
The array looks like this:
Array
(
[TM98800G] => Array
(
[zid] => Array
(
[0] => 90001
[1] => 90002
[2] => 90003
[3] =...
Hi,
I want to have an array of struct (an array of books with their specifications like publication, ISBN number, ...). in wsdl and php. I have searched a little and I have found files that uses Nusoap, However, I dont want to use NuSoap. Is there any solution? I would appreciate if you help me in writing the related wsdl, client and se...
Hi!
I need to calculate an end date based on todays date and a number of months. For example, todays date 04/01/2010 and the number of months is 6. Are there any functions I can use to do some math that would return "10/01/2010"?
Also, I think it's important to note that I am storing the result in MySQL as a "DATETIME" so I guess I wou...
Hello all,
I have switched on the Codeigniter profile (very useful) and I have noticed that a page of mine shows the memory used as:
2,405,496 bytes
That's ~2MB and it's for one request - does it mean if 1000 users accessed this page at the same time, memory usage will be 2GB?
Have I got my maths wrong or is there more to this t...
I have a form with a textarea in it. I log the results to a text file on the server, but I would like to strip out any line breaks a user would put in the textarea, as well as any commas that would interfere with importing the comma-delimited log text file into Excel or something for later use.
I think this has to do with regex, but I'm...
Hello, i want to split the searchrequest into parts, if there's nothing to find.
example: "nelly furtado ft. jimmy jones" -> no results -> try to find with nelly, furtado, jimmy or jones..
i have an api url.. thats the difficult part.. i show you some of the actually snippets:
$query = urlencode (strip_tags ($_GET[search]));
and
$fo...
I've created this code branch so that if the permalink settings do no match at least one of the OR conditions, I can execute the "do something" branch. However, I believe there is a flaw in the logic, since I've set permalinks to /%postname%.html and it still tries echo's true;
I believe I need to change the ORs to AND, right?
if (get_...
Hello,
I would like to know if JSON with AJAX has a limitation to the amount of data an outgoing and returning parameter can carry?
I would like to be able to send and return from the server a file with 10,000 lines, as a string. How should I achieve this task? Will a single parameter will be able to hand this?
EDIT:
My client is Java...
I recently started working for a web firm as a freelancer taking my hobby of coding in PHP to a career level, and since then I have been overwhelmed by the amount of work that needs to be done within short time frames.
The problem isn't being able to do what is asked, but being able to do it all as quickly as is needed of me. I never u...
Hi folks
Not too sure what's going on here as this doesn't seem like standard practise to me. But basically I have a basic database thingy going on that lets users submit code snippets. They can provide up to 5 tags for their submission.
Now I'm still learning so please forgive me if this is obvious!
Here's the PHP script that makes i...
I have a SqlDump.sql file that works just fine when I apply it using the Import feature of phpMyAdmin, however I need to be able to accomplish this programmatically. Being a noob, I tried to do something like this:
$SQL=file_get_contents('SqlDump.sql');
$DB=mysqli_connect('localhost','root','');
mysqli_select_db($DB,'somedb');
if (mysq...
I'm currently having difficulty finding a way of making my loops work.
I have a table of data with 15 minute values. I need the data to pull up in a few different increments
$filters=Array('Yrs','Qtr','Day','60','30','15');
I think I have a way of finding out what I need to be able to drill down to but the issue I'm having is af...
Hi all,
So basically here's my problem. I'm looking for a solution to allow us to connect with SQL Express 2008, while still using MDB2 as our database abstraction layer. I need something like this, mainly because we still need to be able to use MySQL and Postgres (and ORMs seem to be not an option at this point in time).
Preferably, t...
I'm using PHP to upload an image from a form to the server and want to rename the image lastname_firstname.[original extension]. I currently have:
move_uploaded_file($_FILES["picture"]["tmp_name"], "peopleimages/" . "$_POST[lastname]" . '_' . "$_POST[firstname]")
which, of course, renames the file lastname_firstname without an ex...