php

How would I stop this foreach loop after 3 iterations?

Here is the loop. foreach($results->results as $result){ echo '<div id="twitter_status">'; echo '<img src="'.$result->profile_image_url.'" class="twitter_image">'; $text_n = $result->text; echo "<div id='text_twit'>".$text_n."</div>"; echo '<div id="twitter_small">'; echo "<span id='link_user'".'<a href="http://...

htaccess to not show index.php in sub directory

I have a simple page structure like below /directory/subdir_1/index.php /directory/subdir_2/index.php .... (there are no other files in these directories) is it possible to have 'fake/pretty' urls for the above files as below? /directory/subdir_1 /directory/subdir_2 ... so this path would show whether the visitor typed that,/dir...

Who Knows AppWeb HTTP Server And Its Embedded PHP?

Hi all, on my search for a fast but comfortable web server I dropped into the homepage of EmbedThis(TM) AppWeb(TM) HTTP server. This one has 2 licencse models, GPLv2 and a commercial one with support. On the first view it looks good: the footprint is not too big, it is fast and it has a lot of configuration otions. The most important t...

Extending mysqli and using multiple classes

Hi, I'm new to PHP oop stuff. I'm trying to create class database and call other classes from it. Am I doing it the right way? class database: class database extends mysqli { private $classes = array(); public function __construct() { parent::__construct('localhost', 'root', 'password', 'database'); if (mysqli_connect_error()) {...

How do I frequently refresh a specific web page using PHP?

I need a PHP script running on my server to frequently request a web page. I thought of using the PHP header function combined with a meta refresh tag, but that won't work because the header will redirect to the URL immediately, and the meta refresh will never execute. <?php header('Location: http://www.example.com/'); ?> <html> <META...

How To Know the number of seeds/peers for a torrent in PHP

Hi my question is that when you place a .torrent file for download in your website,how can you get the number of Seeds & Peers ,... for that torrent and inform the user of them? ...

php mongodb findOne return as object?

is it possible to return findOne result as object ..or it always return an array? i found something about mongo.objects = 1 adding to php.ini ..but did not work for me. can some one tell me more about this? ...

PHP header redirection not working after installing xdebug

<?php $url = 'http://google.com/'; header('Location: ' . $url); The xdebug setting in php.ini is: zend_extension=path_to_xdebug.dll xdebug.remote_enable=1 xdebug.remote_host=127.0.0.1 xdebug.remote_port=9000 xdebug.remote_handler=dbgp The above header() redirection will work as long as I remove the xdebug setting. Anyone met this p...

mysqli insert problem

Hello i have this error: Warning: mysqli_stmt::bind_param() [mysqli-stmt.bind-param]: Number of elements in type definition string doesn't match number of bind variables in E:\wamp\www\classes\UserLogin.php on line 31 and i dont know what it is :/ here is my code function createUser($username, $password) { $mysql = connect(); if($st...

Submit form without page reloading

I have a classifieds website, and on the page where ads are showed, I am creating a "Send a tip to a friend" form... So anybody who wants can send a tip of the ad to some friends email-adress. I am guessing the form must be submitted to a php page right? <form name='tip' method='post' action='tip.php'> Tip somebody: <input name="tip_e...

Assigning Array with literal string index to an array with numeric index

=== Update === I actually resolved it as : new_array=array_keys($arrayold) Actually my question was quoted wrongly. Thanks Anyways How to Assign an Array with literal string index to an array with numeric index. [IN PHP] Both have the same length...for example Literal >>> array(HELL0=>somevalue1,BYE=>somevalue2) Numeric index >>...

Google Maps Geocoding API - country biasing, bizarre results

I'm connecting to the Google Maps API from PHP to geocode some starting points for a rental station locator application. Those starting points don't have to be exact addresses; city names are enough. Geocoding responses with an accuracy equal to or grater than 4 (city/locality level) are used as starting points, and the surrounding rent...

Doctrine - Multiple models referencing same id field in another model

I have a Files Model, and Multiple (currently 3) different other Models (Article, Job, Event) that can all have files, that are stored in the Files Model. The problem is that when i generate the tables via the CLI-Tool (./doctrine build-all-reload), i get this error message: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot ...

unix commad in php

convert alpha_extract.png -background Yellow -alpha shape alpha_shape.png this is unix command in php how can we run in php ...

Why is this unwanted ">" character being displayed when displaying this PHP document in a browser?

This page takes an asset id from $_GET of the url and displays some info about the asset after querying a mysql database. When I view the page in my browser there is an unwanted ">" character within the page and I have no idea why. I've commented where it appears. It appears before the < table > create tag right afterward. The < tabl...

preg_match basics question.

Hi all. Got some trouble with my preg_match. The code. $text = "tel: 012 213 123. mobil: 0303 11234 \n address: street 14"; $regex_string = '/(tel|Tel|TEL)[\s|:]+(.+)[\.|\n]/'; preg_match($regex_string , $text, $match); And I get this result in $match[2] "012 213 123. mobil: 023 123 123" First question. I want the regex to stop at...

HTML + Button with text and image on it.

Hello, I have a problem in creating a Button with text and image on it. <td> <button type="submit" name="report" value="Report" <?php if($tab == 'Excel') echo "id=\"tab_inactive\""; else echo "id=\"tab_active\"" ; ?>> <img src="images/report.gif" alt="Report"/>Report </button> <button type="submit" name="excel" value...

get or session?

i have a login form, which is in login.php. after authorization i moove client to some.php file! so, from following two methods, which is better? i can send information aboud user id e.t.c by GET i can use SESSION - s for this what is more preferred? and two words about why i ask this question. i hear somewhere that SESSIONs aren't ...

MySQL String Function equivalent to PHP ucwords() function

Is there a MySQL String function equivalent to PHP ucwords() function. The end goal is to use MySQL to uppercase the first letter of each word in a string. Example. -- The name field in the table holds "JOHN DOE" SELECT LOWER(name) FROM table This will give me the result 'john doe' I want the result 'John Doe' ...

RAD Visual Web Application Creator/ Builder/ Designer for PHP

Hi all, I want to see if any of you know a (free and open source will be ideal) tool/ app that can help build a php web application very quickly without investing too much time on writing codes, preferring drag and drop/ point and click work-flow designer for logic design (see Agile from Outsystems below). Plus, visual designer for the ...