php

Problem checking the name of a file in php

I am writing a PHP page to convert an uploaded file to XML. I only want to convert the news file to XML. The only file that ever needs to be converted is news.htm. I have narrowed my problem down to this if statement. What is wrong with it? $fileName = basename( $_FILES['uploaded']['name'] ); if( strcmp( $fileName, "news.htm") == 0 ) (...

Understanding what SPARQL is

This is a terribly beginner series of questions, but after reading through a good 30 SPARQL tutorials I can't seem to wrap my head around what SPARQL is or how to begin using it. Is it executed on the client side? Is microsoft somehow going to be able to mess this up? Can you use a common relational database (SQL)? Are there particul...

php: check if certain item in an array is empty

In PHP, how would one check to see if a specified item (by name, I think - number would probably also work) in an array is empty? ...

Does UNION ALL return an array?

I have a sql statement that is a union of several queries. "SELECT a, b, c, 'd' as type FROM x WHERE id = $id UNION ALL SELECT a, b, c, 'e' as type FROM y WHERE id = $id UNION ALL SELECT a, b, c, 'f' as type FROM z WHERE id = $id ORDER BY a DESC LIMIT 10"; I try to iterate through the results and get 'a' value for each row but can't...

Ampersand using Javascript & PHP

I'm trying to redirect a page using javascript output using php. The problem I'm having is passing the ampersand as you can see below. Input $url = 'number=1&id='.$usrid->id; echo "<script type='text/javascript'> window.location = 'directory?$url'; </script>"; Output The above return on browser address bar this: http://www...

PHP - FTP subdirectory recursively?

The code below works insomuch that I can successfully download the directory recursively. But, I want to download the directories within this directory. So, when it connects it's in . Within the . directory is a subdirectory "In". I want to recursively retrieve the contents within the In directory. The directory names themselves wil...

YUI Text Editor is not working in my Mozilla

I am experiencing this problem for few hours now and really not sure how to solve this. However its work fine in IE but it is not working in mozilla. Here is my code: <!-- Skin CSS file --> <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.7.0/build/assets/skins/sam/skin.css"&gt; <!-- Utility Dependenci...

Including dynamic HTML with PHP

I have PHP variables to place within an included HTML file. What's the best way of executing this? //contents of file1.php $variable1 = "text 1"; $variable2 = "text 2" $newContent = include('file2.php'); echo $newContent; //contents of file2.php <p>standard HTML with PHP... <strong><?=$variable1?></strong></p> <p><?=$variable2?></p> ...

problem with resubmission of form data

Hello, I am a newbie trying to develop some login panel. The problem now is that I am not able to stop resubmission of form data on pressing back and forward button of browser. Tried to find it on google but no effective solution come up. Please enlighten me on this. ...

Issues with links while trying to converting HTML to XML

I am trying to convert an html file to xml. It is working for the most part. The issue I am having is with links. Right now it seems to be completely ignoring the link in my test file. Here is the convert code: <?php ini_set('display_errors', 1); ini_set('log_errors', 1); ini_set('error_log', dirname(__FILE__) . '/error_log.txt'); e...

Editable Dropdown?

I have a php page with 4 text boxes, each need a "drop down" when the text boxes have the focus. Clicking the options would populate the (editable) text box(es) and close the drop down. The text boxes are of course part of html forms. How can I do this inline with javascript or ajax using minimal code? ...

sudden database disconnection in following code

I am recording the time at which the user downloaded a specific file using the following code. However, in this code, initially the download time is coming but later it's disconnecting the data base connection between client and server. If I remove the 'exit' (as shown), everything is coming fine but the downloaded file can be corrupted...

OK to skip slash before query string?

Is it safe to always skip the trailing slash when appending a query string? http://example.com?querystring Instead of... http://example.com/?querystring All webhosts I've used support this but Is it safe to assume that all server environments will support this method, is it standard? ...

PHP how to treat nonexistent URLs on a single entry point site that uses mod_rewrite

I am developing a web site in PHP and I am using mod-rewrite to implement a single point of entry in index.php. From there I am using a dispatch table to dynamically create content for each URL (can be from a DB or other means). I am not sure what is the correct way to treat URLs that are not in the dispatch table. I would like to retu...

PHP square instructions not Algebra

I am creating an array named "fifty" with 50 elements. Instruction #1:Initialize the array so that the first 25 elements are equal to the square of the index/key variable. When squaring we are raising a base or number to some power so in PHP we need some function like this: <?php print pow(10,2); // Squared raised to the 2nd power...

I want to add delete option for table

I have one table which is fetched from MySQL database. I want to add delete options for every row that has to be removed both in server and client side. Can anyone give the steps to do delete option in PHP and MySQL? ...

How to get the first item from an associative PHP array?

If I had an array like: $array['foo'] = 400; $array['bar'] = 'xyz'; And I wanted to get the first item out of that array without knowing the key for it, how would I do that? Is there a function for this? ...

same form data, different actions on two separate submit buttons

I have what is essentially a shopping cart that needs to have two separate checkout options. The first of which takes the user away from the site, but form data must be posted. How can I create two submit buttons that will send the same form data to their own separate page? ...

Why am I receiving an unexpected T_CONSTANT_ENCAPSED_STRING error?

I am getting this error: Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in C:\wamp\www\vacation_showcase\admin\participants_edit_list.php on line 17 This is my sql statement: $sql = 'SELECT substring_index(description,' ',100) as preview, name, extra_line, link FROM participants ORDER BY name ASC'; I dont know why...

[PHP] [DataGridClass]: How to make second column of the resultset a hyperlink?

I am using following class to show a grid like appearance with pagination on my home page. The class is very good and is working fine. When the grid shows records, I just want to make the second column values as a hyperlink. I tried adding a href ... in the class where $c is updating, but it is not working. Can anyone help me out. Thi...