php

How to generate sequential GUIDs?

Are there PHP libraries to generate sequential GUIDs for usage in a MySQL database? ...

Upload problem with PHP: Thumbnail picking up the image name.

I have the following model(codeigniter) code to upload image and thumbnail. However the result of image path becomes, images/comfort_big.jpg and images/comfort_big.jpg.jpg. The thumbnail image picks up the name of image and add .jpg. I am uploading images/confort_thumb.jpg for thumb. Can anyone tell me what's wrong please? if ($_FIL...

Does it exists a shorter if statement in PHP?

Is it possible to rewrite this to be shorter somehow? if (isset($_POST['pic_action'])){ $pic_action=$_POST['pic_action']; } else { $pic_action=0; } I have seen it somewhere but forgot... :/ BTW, please explain your code also if you like! Thanks ...

Need to search a content which is in greek letters using strtoupper and strtolower

Hi all, I am currently working in a GREEK project. In that project all the contents are GREEK and in that i have a search functionality. Search process is good. But strtoupper() didn't convert the Greek language to upper case and strtolower() didn't convert the Greek language to lower case. But for English language its working fine. I...

Zend Framework: How to get my statuses from twitter

I want to show my last 5 or 10 statuses from twitter on my site. For now I am using following code to get my twitter statuses. public function getOrganizationsTwitterUpdates(){ $twitter = new Zend_Service_Twitter('myusername', 'mypassword'); $response = $twitter->status->userTimeline(); return $response; } And I have ...

301 redirect in codeigniter

ok, so i can't tell if this is a server issue or what. i've got an htaccess file like so: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} ^system.* RewriteRule ^(.*)$ /index.php?/$1 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php?/main/index/$1 [L] RewriteRule ^ajax/(.*...

Model & Mapper relationship

Hi there, I currently work on a small application with models, mappers and controllers. My question is, (because I did not found any matching answer), how does the mapper interact with the model (& the controller), when we have the following situation. $user = new UserModel(); $user->setId('21'); $userMapper = new UserMapper($user); $u...

php code help for incoming google and yahoo links

hi, Actually i am working on a web site and on that site i want to add two more features like, Incoming google links: Incoming yahoo links: when user write his web site url in text box then the result show below the total incoming google and yahoo links. If anyone has the knowledge of this, then please help, waiting,,thanks ...

how to read stdin from a yii command

Hi There, Does anyone know how to read stdin using a custom Command in the Yii framework? I am busy writing a script to process incoming mails through a php script but need functionality from within the Yii framework as well. By default Yii passes the command line arguments in a variable to your run() method when you extend the CCon...

Codeigniter validation

I have many goals to be printed on the screen. but it shows error when i use it like this echo $this->validation->rshort_goal.$i; What is the right way to use this? if($sgoal !='') { $scount = count($sgoal); $i =1; foreach($sgoal as $row) { <textarea name="rshort_goal<?php print $i;?>" id="short_goal" class="sho...

How should I call a layer of auto-generated code?

I have a framework which works this way: After defining some meta data, it generates PHP code with PHP classes. These classes are abstract and are intended to be subclassed. For example, if I define a User class in the backend, it will generate an UserBase class which I simply subclass like: class User extends UserBase { //.... } ...

Yet another 'Call to a member function on a non-object' problem

I have a html page that calls a php object to get some data back from the database. It works fine, but the script was getting unwieldy so I decided to break some of it out into a bunch of functions. So I have the following files: // htdocs/map.php <?php include("config.php"); include("rmap.php"); $id = 1; $gamenumber =...

black image when forcing download

when i click a button the browser force the image to download the code work it download the image with the right size but it's all black im using this code : // get attachment location $attachment_location = "files/image.jpg"; if (file_exists($attachment_location)) { // attachment exists // send open/save...

Deleting Multiple records in php My sql

<?php $host="localhost"; // Host name $username="root"; // Mysql username $password=""; // Mysql password $db_name="toybox"; // Database name $tbl_name="Emp"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("canno...

retrieving a mysql query

I have written a mysql query and fetched the result as an assoc array using mysql_fetch_assoc().The query returns a list for two fields.I am looping through this field using through the result array and am extracting the value.how do i display the two fields since doing a plain echo is not working for me?The code which i have written is ...

add parameter to google query

Hello, I am trying to get the realtime stockquotes from google for some time now. First I try'd the finance api, but that didd'nt work out. Then I saw this query and it seems to good to be true http://www.google.com/finance/info?client=ig&amp;q=goog It must have some drawbacks that I am not aware off now. Anyway, it does give realt...

.htaccess mod rewrite automatically using php or something?

I've got a number of users, each with the website page like http://www.mysite.com/folder/artist%5Fid.php?id=33 The users need to be able to set their own easy URL such as http://www.mysite.com/userguy that would redirect to the above page. I know how to write these out manually in .htaccess with RewriteRule but, for example, users have...

Content negotiation and HTTP headers in PHP

This is a following to my yesterday question: http://stackoverflow.com/questions/1975416/trying-to-understand-the-vary-http-header I have a .php that can be served with different MIME types. To do this I use "Vary: Accept" HTTP header (which is confirmed to be correct). But what if the same document (with the same URL) can be served in ...

Twiiter like real time response using PHP

Can anyone explain how does the real time response works in Twitter ? Like when u search in twitter while viewing the result u get real-time updates saying "7 more people tweeted" . I have noticed there is no AJAX call being made. Can someone tell me how this works and is it possible to implement such a thing using PHP ? ...

Unwanted space producing at each side in browser for wrapper. Why?

I want my background to cover the total width of the browser like in facebook website http://www.flickr.com/photos/41695354@N08/4228675694/ but my background gives gaps on both side of the browser (left and right) http://www.flickr.com/photos/41695354@N08/4227911233/ why this happens?? Help me my css body { color:#000000; backgrou...