php

Create table if not exist - unexpected T_STRING

Hi, I am having an issue trying to create a table for a website I am working on, here is the database code I am using but I get an error at line 2. <?php CREATE TABLE IF NOT EXISTS 'speakers' ( `id` int(11) unsigned NOT NULL auto_increment, `name` varchar(255) NOT NULL default '', `image` varchar(255) NOT NULL default '', ...

C++ vs PHP performance on PCA

May I know whether C++ or PHP is more efficient on running PCA (Principal Component Analysis)? I'm developing a web based system which get uploaded image with php, and then process the image so that I can analyse the image with PCA to find out whether the image match with another image which already stored in database. But I'm wonderin...

PHP: Add words to pspell?

I am using pspell like this: $ps = pspell_new("en"); if(!pspell_check($ps, $word)) { $suggestion = pspell_suggest($ps, $word); } However I want to added some industry terms to the list. I looked up pspell_add_to_session which says the first param is supposed to be int $dictionary_link But I do not know what that is and there i...

Check if web page ok before redirecting?

How do I create a php file "redirect.php" That takes 1 input parameter "URL", have to check the URL Page is not dead before rediecting? Example 1 user clicks on link http://domain.com/Redirect.php?URL=http://example.com/page1.php 2 redirect.php checks if page (http://example.com/page1.php) is ok! 3 if ok redirect user to http://exam...

google maps - showing default icon instead of custom icon

Can someone look below and tell me where I'm off? I can't get the custom icon to display - only the default. thanks - <script type="text/javascript"> //<![CDATA[ <?php if ($er_imglayout == 4 && $row->image2) { ?> function domap() ...

inserting unicode characters into mysql database shows ??????? in field

Hey guys I am having trouble trying to convert my web app to support unicode characters. I have the following script which tries to insert russian characters into my mysql database but just outputs ?????? in my mysql database field. I have changed default charset to UTF-8 in my php.ini and have modified my table fields to collation: utf8...

how does OpenID differ between different logins on the same OpenID endpoint

I am trying to implement an own OpenID endpoint based on SMF user accounts. I based my code on phpMyOpenID and some SMF authorization code. It works fine so far. I can use the endpoint to login/register on any site. If I am not logged in on the SMF, it will ask for my login and if that SMF login is successful, it accepts it. However, i...

php and special characters

Hi-- I'm trying to parse a string from a French text, and I'm using both htmlspecialchars and html_entity_decode-- but certain characters aren't getting properly converted. Any ideas? Here's the code: html_entity_decode(htmlspecialchars_decode($this->string($tstring))); // returned from web service In particular, the entity that isn...

SimpleXML loop works but breaks half way through

I have a loop going through results from a youtube feed and it works fine but towards the end it fails with the error: Warning: main() [function.main]: Node no longer exists in ../youtubereader.php on line 8 Warning: main() [function.main]: Node no longer exists in .../youtubereader.php on line 8 Fatal error: Call to a member function a...

will this work as an alternative to http cookie?

I'm using php for my site and was wondeirng if it would be a good idea to use the $_SERVER md5($_SERVER['remote_addr'] + $_SERVER['http_user_agent'])) into a cookie_auth field in the user table. When the user logs in, php will use the above key to re-check the current user and compare it to the stored key and if matched get credintial...

Convert array to PHP code

Following my last post about better syntax for arrays, I've decided to use JSON format for arrays and use a method to convert them into PHP code. Note that the ultimate goal of this is to be write a $config array in JSON and translate that into PHP code (so I can avoid having to use PHP's ugly array syntax): The function works fine fo...

How to highlight a currently selected item/section in Wordpress with CSS (maybe PHP too)?

I would like to have the currently displayed Page or Recent post highlighted with CSS. Something like this: PAGES: ...Home ...About <--current page ...Contact RECENT POSTS: ...post1 <-- current post the user is seeing. ...post2 ...post 3 I used to accomplish that assigning an unique id to the body tag to make each page unique f...

Class: ADORecordSet_mysql Easy way to get an Array indexed by id of row

Hi, I have a table with a primary key called 'id' and I am using ADODB and getting a ADORecordSet_mysql back. I need an array where the id is associated with a row in the result set, but ADODBRecordSet_mysql only seems to have a GetArray(int startingRow) method that returns an array indexed by startingRow (where the default is 0). I ...

PHP: how can I load the content of a web page into a variable ?

hi, how can I load the content of a web page into a variable ? I need to store the html in a string thanks ...

Transferring a site - various file issues

I am putting an old website up on a new server and i've noticed various issues. Firstly, if i look at any of the files locally they all have double line spacing - anywhere there is a newline there has also been a blank line inserted. This is the same in netbeans and notepad++. Then, when i SFTP the files to the server and view them in Vi...

Get started to build a website

Hello SO'ers I want to learn to develop a small website. Any help how to get started with it. I come from a windows app background and i want to get started with web apps. Cheers this-Me ...

Require upload of a file in HTML/PHP form

Hi, I'm trying to require a file upload in a form, but cannot get it to work. Any ideas? I'd rather echo the php error on the page vs. a javascript popup. Thanks for taking a look: <?php // initialize $file1 $file1 = $_POST['file1']; // check upload of $file1 if ($file1 == '' ) { $error = "Please upload an image"; } ?> ...

How to process stdin to stdout in php?

I'm trying to write a simple php script to take in data fro stdin, process it, then write it to stdout. I know that PHP is probably not the best language for this kind of thing, but there is existing functionality that I need. I've tried <?php $file = file_get_contents("php://stdin", "r"); echo $file; ?> but it doesn't work. I'm in...

@ (or "at sign") is ending my MySQL query early, resulting in error.

I am working on my first login script. I have been following examples from a book, but this is where I am stuck. I want the user login to be an e-mail address, but when I would hit submit, I would get this error. Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in C:\wamp\www\mysite\index.php on line 19 ...

How to keep some of word be uppercase on ucwords

Example in my database SMK SUNGAI PUNAI $school = 'SMK SUNGAI PUNAI'; echo ucwords(strtolower($school)); Ouput Smk Sungai Punai Question How to make the output will be SMK Sungai Punai which the SMK still in uppercase. Update. The problem I have 10K list of school name. From PDF I converted to mysql. I copied exactly from PDF the ...