php

Firefox and IE aren't displaying "<script ... > ... </script>" provided from PHP.

Hey everyone, I am having a problem with a website I'm trying to build; basically I have a class that I call from my header file that loads all of the link and script tags. The link tags show up across all browsers, but the script tags only show up in safari and chrome, they do no show up in firefox or IE. <script type='text/javascript...

xpath query to xpath result of query

for example we have this xml: <body> <a> <b> <c>hello</c> <c>world</c> </b> </a> <a> <b> <c>another hello</c> <c>world</c> </b> </a> </body> by Xpath query we can find all "B"-tags. But then w...

Display a random set of 10 questions and answers with MySQL and PHP

I'm making a survey with PHP and MySQL. I'm having trouble figuring out what method to use to display a random set of 10 questions, and their answers. Each question can have between 2 and 5 answers. Here is how the database is set up: questions: ID | quID | question answers: ID | an_quID | anID | answer quID and an_quID link the tab...

Clearing APC caches without crashing our scripts

Currently, when we update our PHP code for our website, we have a script that calls apc_clear_cache on all servers, so that the new code will be used. We also have some PHP scripts that run in the background on a separate server, processing some slower queries, and the like. The same script that calls apc_clear_cache also notifies the s...

How to display a users name using PHP SESSIONS?

I was wondering how would I display a logged in members users name on every page using PHP SESSIONS? ...

Post/Redirect/Get Model -- Sessions & Security

I'm looking to build an ecommerce form using the PRG model. My question is on how best to hold the users credit card information during each page transition (page 1 input, page 2 review/submit, page 3 thank you) -- is a SESSION the best way to handle this, and is it secure enough? If not storing in a SESSION, how else would I do it? I...

PHP session_start() question?

can I include my session_start() in my header include or should I past session_start() in every pages? Is there any pros or cons in pasting the session_start() in the header include? ...

Return values and exceptions for PHP functions

I'm reading some books on PHP (specifically "PHP and MySQL Web Development" by Welling and Thomson) and I'm also a fresh undergrad. I was a bit curious why the author decided to choose two different ways to terminate the execution of a function, e.g. if (!$result) { throw new Exception('Password could not be changed.'); } else { ...

PHP ob_start and session_start question?

Should I use ob_start() before session_start() or session_start() before ob_start()? ...

WebSocket Events Not Firing

I'm trying to create a simple WebSocket example using the HTML5/JS API. Based on what I trace out on the server, it seems like the socket is connecting, but none of the events fire (onopen, onmessage, onclose, etc). I'm a Flash developer so I'm not very good at debugging the JavaScript and I'm hoping someone can help me out. Here's the c...

move_uploaded_files works with suPHP, but not DSO

i have a dedicated server with one site. i have DSO enabled. i have to have it enabled as suPHP is a serious resource hog. the load time between DSO and suPHP is night and day. i have an issue with move_uploaded_files. under DSO PHP is running as a webserver process. the file's owner is always set to nobody and move_uploaded_files throw...

What are my options for creating an iPhone app from an existing PHP website?

I have an existing PHP/MySQL website that relies hugely on form POSTs for things like signing up, logging in, searching etc. I now need to create a native iPhone app for it. The business requires a native app for marketing reasons, I can't get away with a mobile optimized website. I'm looking for suggestions from someone who has already...

Quicker Forms html/php ?

Hi lad's, I'm working on a project at the moment that requires alot of forms. I was thinking of a workaround to minimise spending hours of time on the subject. Above all else I don't want to use a framework to do this for me, I'm still learning so its important for me to understand at the core. Ok so I have a class called form builde...

How to insert a string that contains quote marks into a database?

When I try to instert a string that contains a quote mark, the INSERT query fails. How can I insert strings with single or double quotes? for example: $message = "Bob said 'don't forget to call me'"; mysql_query("INSERT INTO someTable (messages) VALUES ('$message')"); I figure the input needs to be filtered but which function should...

PHP call static workaround for PHP 5.2

Is there are way to get __callStatic, or similar, functionality in PHP 5.2? I'm finishing a PHP Framework and need to use this functionality for a Database ORM class. So for example you can use the code below to get data from column 2 and column 4 of the database table i.e. by declaring methods dynamically according to what you want (li...

Get Doctrine Relationships in DQL

I have three tables: Project: ... relations: User: local: authorId foreign: id Users: class: User local: projectId foreign: userId refClass: UserProjects User: ... relations: Projects: class: Project local: userId foreign: projectId refClass: UserProjects ...

Help me to decode: eval(stripslashes(gzinflate

I can't seem to decode this base64 string which is in the footer of a wordpress theme. I want to be able to add more to the footer. Any help appreciated, thanks! <?php eval(stripslashes(gzinflate(base64_decode("fZHBasMwDIbvhb6DyGHtLs19zRIoY9tte4BAsRMlNjiWScSyvP0Ur3iFlvliR/ry/+JXVRZ5a7/K7aaQCxqnpum5zhryjJ41MdNQZwm6YLYVpiNiHKW53UA6Dw2F5Q...

Iterate over specific files in a directory

I need to get all images that begin with "t_" using glob. What pattern should I use to do this? //get any image files that begin with "t_" -- (t_image.jpg) not (image.jpg) $images = glob("" . $dir . "*.jpg"); foreach($images as $image) { echo $image; } ...

display js inside php while loop

I found the count down script in http://www.dynamicdrive.com/dynamicindex6/dhtmlcount.htm It works fine if i just define the date but when I try to pass the date from this php/mysql query into the js file, it works only for the first record and not after that. <script type="text/javascript" src ="time.js"></script>//this is the script ...

getElementById in a FOR loop not working

I'm not sure why this isn't working. I have a record list of text fields in a form: <input type="text" id="x1_Order"> <input type="text" id="x2_Order"> <input type="text" id="x3_Order"> <input type="text" id="x4_Order"> <input type="text" id="x5_Order"> ... <input type="text" id="x253_Order"> <input type="text" id="x254_Order"> <input ...