php

unique random id

I am generating unique id for my small application but I am facing some variable scope problem. my code- function create_id() { global $myusername; $part1 = substr($myusername, 0, -4); $part2 = rand (99,99999); $part3 = date("s"); return $part1.$part2.$part3; } $id; $count=0; while($count == 1) { $id; $id=create_id...

jQuery - now: Creating an object and storing values in it to pass to an AJAX call

I have an array: myarr = []; I'm filling it with some values: myarray['name'] = "Me!"; Now I want to transform that array into a set of Key => Value pairs. I though jQuery would do it automatically, but it doesn't seem to. $.ajax ({ type: "POST", dataType: "text", url: "myurl", data: myarr }); Is there a way to d...

Running lame from php

I am trying to run lame from a php script. I have tried these, but no luck, I don't get anything returned! Any ideas? system('lame', $returnarr); system('lame --help', $returnarr); exec('lame', $returnarr); passthru('lame', $returnarr); even this one returns nothing: exec('which lame', $returnarr); I am on OSX and final deployment...

How can I get offline Doctrine 1.2 documentation

I need to have offline documentation for Doctrine 1.2. I just don't seem to find it anywhere, while I remember having seen something like that. Who can give me any pointers? ...

What's the best way to transition to MVC coding?

It's been around 5 months since I picked up a PHP book and started coding in PHP. At first, I created all my sites without any organizational plan or MVC. I soon found out that was a pain.. Then I started to read on stackoverflow on how to separate php and html and that's what I have been doing ever since. Ex: profile.php <--this file ...

Warning: mysql_query(): 3 is not a valid MySQL-Link resource

I got this odd error and I can't figure out where it came from: Warning: mysql_query(): 3 is not a valid MySQL-Link resource in (...) What's up with the 3? I don't get it. Has anyone experienced this error themselves? ...

Thinking about introducing PHP/MySQL into a .NET/SQL Server environment. Thoughts?

I posted this over at reddit but it didn't gain any momentum. So here is what is going on: our company was recently purchased by another web shop and I was promoted to head of development here in our office. Our office is completely .NET/SQL Server and the company who purchased us is a *nix/PHP/MySQL shop. Now several of our large cli...

PHP use function return value as array

Why is it that this works: $cacheMatchesNotPlayed = $cache->load('externalData'); $cacheMatchesNotPlayed = $cacheMatchesNotPlayed['matchesNotPlayed']; But this doesn't work: $cacheMatchesNotPlayed = $cache->load('externalData')['matchesNotPlayed']; Is there some reason for it? The second bit is easier to wri...

Applying iterative algorithm to a set of rows from database

Hello, this question may seem too basic to some, but please bear with be, it's been a while since I dealt with decent database programming. I have an algorithm that I need to program in PHP/MySQL to work on a website. It performs some computations iteratively on an array of objects (it ranks the objects based on their properties). In e...

never ending loop : fatal error

my code- function create_id() { //global $myusername; $part1 = substr("Piyush", 0, -4); $part2 = rand (99,99999); $part3 = date("s"); return $part1.$part2.$part3; } echo create_id(); //this is printing fine. function isUniqueUserID($userIDToCheck) { $sqlcheck = "Select * FROM ruser WHERE userId...

How to Send File over secure FTP SSL Protocol

I appreciate any help that can be offered on the subject. At the end of an online enrollment, I am taking customer data (several fields), putting them in a CSV file and trying to submit to another client over SSL protocol but have no idea how this is done. I am also storing the information on a local database and am hoping the process is...

php if statement not working in internet explorer

Hi everyone, ie does not render my php if statement well, any ideas? I say this because it works well in firefox. <input type="image" src="Images/submit.png" value="REGISTER" name="command" /> if($_REQUEST['command'] == 'REGISTER'){ print "test"; } else{ } It is not printing "test" ...

Can I assume Flash and PHP will generate the same floating point numbers?

In a multiplayer game I'm developing, we have a few values that are floating point numbers. The back-end (in PHP) and the front-end (in Flash) occasionally perform the same calculations on these numbers, to minimize communication. I am currently making sure that both sides are using 64-bit doubles, but am I safe to assume that all calcu...

PHP fails silently when function not defined?

I am migrating from PHP4 to PHP5 I have this in my .htaccess: php_flag display_errors on php_value error_reporting 2039 Which used to show all errors. I am still getting some errors but I used to get an error when I called a function that was not defined, but now it stops where it is at and send the client everything up to the error...

TV Guide script - getting current date programmes to show

This is part of my TV guide script: //Connect to the database mysql_connect("localhost","root","PASSWORD"); //Select DB mysql_select_db("mytvguide"); //Select only results for today and future $result = mysql_query("SELECT programme, channel, episode, airdate, expiration, setreminder FROM mediumonair where airdate...

Is something wrong with this php GD code?

if ($img = @imagecreatefromjpeg('./images/upload/13/1.JPG')) { imagejpeg($img, $path, 100); imagedestroy($img); } else { die ("image was not created or saved"); } I'm getting the message: Warning: imagejpeg(): 8 is not a valid Image resource in C:\xampp\htdocs\invivid\libraries\photogr...

PHP Check slave status without mysql_connect timeout issues

I have a web-app that has a master mysql db and four slave dbs. I want to handle all (or almost all) read-only (SELECT) queries from the slaves. Our load-balancer sends the user to one of the slave machines automatically, since they are also running Apache/PHP and serving webpages. I am using an include file to setup the connection to...

Excuting Java JAR from PHP will not work

I have a java program that generates an HTML file. The Java program takes two input parameters: file1 and file2, the output file is specified by the "--file=". When executed from the command line (UNIX, Mac OS 10.6.2) it looks like this: "java -jar program.jar http://my.testsite.com/test1.html http://my.testsite.com/test2.html --file=...

Question about software that tracks divs better than notepad++

I recently got hired as a web developer, and the project that I am overseeing has a formatting issue on one of the pages because one of the divs is out of whack. It is a fairly complex page with quite a bit of php, and from what I can gather, I am missing a </div> tag somewhere, and accordingly everything is messed up. I am currently us...

Couldn't get last insert identifier symfony sql server through ODBC

Im getting that error every time I try to add a new set of data to my sql server 2008 database. I'm running windows 7 on my development machine. my current config is: all: doctrine: class: sfDoctrineDatabase param: dsn: 'odbc:Driver={SQL Server Native Client 10.0};Server=localhost;database=jobeet;' username: sa password: **...