$dml = "insert into table ...";
mysql_query($dml,$con);
The above insert something into a table.then you can check if it succeeded by either
if('' == mysql_error($con))...
or
if($id = mysql_insert_id($con))...
What's your choice and reason?
BTW,will the below still have $id fetched when running both of them,I've not tried yet:
...
I'm busy writing a PHP app that gets data from a database, but I need to get the data in a certain order.
My Query looks as follows
$sql = "select id,title,type from campaigns where id=$cid order by type";
Now my problem is these are the different types 'GC','MJ','MU','MS','MW','MX','GS' and I want MX to always be select last, thus s...
Edit: The question concerns 100% web development only. Please do not relate the question to desktop development. Please read the entire question before responding.
I am certainly interested if there is currently any interest in developing PHP applications in a more desktop-like fashion. I mean something like the classic WebForms impleme...
I wrote a "Sign in with Twitter" option for my webapp on my local machine using this Twitter OAuth library - https://docs.google.com/View?docID=dcf2dzzs_2339fzbfsf4 and it all works great. But when I move the code to the actual production server it fails on getting a Request Token (a.k.a. the first step) with a simple "Failed to validate...
Hello,
I'm working on a project in GWT, however, I need to store the uploaded files on my personal web server.
The user will upload the files using GWT, my back end will store the files information in AppEngine's database and send the file to the server.
I'm thinking of creating a PHP script on the web server that will handle the file...
Hello everyone,
I'm trying to realize the function similar to the website: site. I know it's done with jQuery. But can someone guide me with more details?
Thanks very much.
Edit:
The function i need is the chained menu and a result set on the right side. I want the chained menu to be generated automatically from mysql.
...
The statement below will load all images that do not begin with an underscore character...
if (!is_dir($file) && preg_match("/^[^_].*\.(bmp|jpeg|gif|png|jpg)$/i", $file))
I need to modify it so that it only loads images that DO BEGIN with an underscore.
...
I'm generating a table with multiple editable rows. like a employee every row so that you can change multiple names at the same time. I have some hidden fields inside that also need to be looped with the table rows.
The problem is that having inputs inside table tags is not valid xhtml. And I don't want to wrap them inside <tr><td> tags...
I have a strange situation with PHP working differently from HTML. I'm not a web programmer, just messing around. In HTML my images appear fine, in PHP the images are broken. And only public images from my Dropbox https server are broken, ones from a http server work.
As an example, here are two files on my localhost, abc.html and def.p...
I need to find the number of indexed pages in google for a specific domain name, how do we do that through a PHP script?
So,
foreach ($allresponseresults as $responseresult)
{
$result[] = array(
'url' => $responseresult['url'],
'title' => $responseresult['title'],
'abstract' => $respo...
I have two postgres queries that i execute using PHP and both of them result a Resource, is it possible to combine or concatenate these two resources?
...
Hi
I have been trying to get a php contact form working on my portfolio site (currently on a free megabyet.net account), but on testing it(on the uploaded site) even though i get the thankyou/confirmation message, I still don't receive any message on my mail account (specified in the code), I can't seem to understand the problem here......
I have made a method which will delete a file.
first i echo the url to this file.
like this
echo "<a href='$fulr'>$filename</a>";
now basicaly i want to call the function deletefile($file);
how can i do it like this
echo "<a onclick='$this->deletefile($filename)' href='$fulr'>$filename</a>";
is that even posible?
Or how can i i...
My team have to maintain a large php application that was very poorly written. It is a mix of html, javascript and SQL on top of a large poorly designed database (ex. it has a table with few hundreds of columns). The only advantage of the codebase is that it works.
We are constantly bug fixing and rewriting parts of it.
I would like t...
$test = array('hi');
$test += array('test','oh');
var_dump($test);
What does + mean for array in PHP?
...
I have a string (in PHP) representing a JS array, and for testing purpose would like to convert it to a PHP array to feed them into a unit test. Here's an example string
{ name: 'unique_name',fof: -1,range: '1',aoe: ',0,0,fp: '99,desc: 'testing ability,image: 'dummy.jpg'}
I could use a explode on the "," then on the colon, but that is...
Hi, guys!
I need to split a Chinese sentence into separate words. The problem with Chinese is that there are no spaces. For example, the sentence may look like: 主楼怎么走 (with spaces it would be: 主楼 怎么 走).
At the moment I can think of one solution. I have a dictionary with Chinese words (in a database). The script will:
1) try to find th...
Hi, I'd like to know if it is possible to create a prepared statement with PHP and MySQL using the mysql library rather than the mysqli library.
I can't find anything on the PHP documentation.
Thanks.
...
So I've made a simple C# application and I'm currently using HTTPrequests to login to my phpBB forum, using a custom PHP file to check the post count of the user, and consistently resends HTTPrequests every 30 seconds. Unfortunately, I fear that this can easily be cracked despite the obfusculation. I've heard of serialization, but I don'...
im creating a log function that will log my errors in a file.
i thought it will contain which class and method the error occured in.
is there a way of logging in which class and method the error occured in so i dont have to type it manually each time?
...