php

DD-MM-YYYY date format and mysql

I have a mysql table : dateStarted varchar(45) dateEnded varchar(45) Example: There are varchar (I dont know why Previous programmer used this). Can I search between two dates in mysql with varchar type? Thanks in advance ...

[Zend Studio] Disable Semantic Analysis on external libraries

I'm using Zend Studio to work on several PHP projects. Most of these projects include several external libraries. I've got these tucked away in a "libraries" directory within each project (using a public, application, libraries structure). The libraries are included using svn:externals - we made this choice so that it's easy to keep them...

What are the bad things present in following code?

What are the bad things present in flowing code: print "<ul>" $conn = mysql_connect( "localhost:8080", "root", "admin" ); mysql_select_db( "testdb", $conn ); #selects a database $q = " SELECT * FROM table1 WHERE id > " . $_GET["id"]. ";"; $res = mysql_query( $q, $conn); while( $row = mysql_fetch_assoc($res) ) { print "<li>".$row['descri...

ServerSide(PHP) vs. ClientSide(JS) running trade off

I have a collection of rows, I can generate Table(HTML) out of it using PHP (server side) or I can send the raw data to the client side and generate the Table there using JavaScript Which one is better and way? ...

Calling a PHP Function into sql query

I have a MySQL table called "invoice_prod" : id | qte | price | id_tva And another table called "tva" : id_tva | content Now, I want to find the total of an invoice, so I made this query and it works. $sql_mnt = mysql_query(" SELECT SUM( (qte * price) * ( 1 + (tva / 100))) AS total_un_prod FROM invoice_prod WHERE i...

MySQL: problem with SELECT SUM()

my query: SELECT events.*, SUM(analyt_event_hits.ajax_hits) AS ajax_hits FROM events LEFT JOIN analyt_event_hits ON events.event_id = analyt_event_hits.event_id WHERE events.date >= '$d' the problem: this is only returning one result, when it should be returning many. The query works fine if i remove SUM(anal_event_hits.ajax_...

php read from file float

Hello I have a text file with three lines. every line has a float number. How can I take each value and put in a float variable even if array? For example text file is like the following +3.01\n -0.0012\n -0.1\n I want an array [if it possible] which save the values as float not as string. Thanks ...

Stand alone "SEO Smart Links" plugin functionality

Anybody can provide code snippet how to implement something like "SEO Smart Links" does ? Here is what it does: SEO Smart Links can automatically link keywords and phrases in your posts and comments with corresponding posts, pages, categories and tags on your blog. So e.g. I will provide array of keywords + links, pass it to the funct...

Authentication with Pear Auth() and access levels

Looking on the web to find a good tutorial for implementing an auth system with Pear Auth(). I need to use different user permission, storing access level in a db field. On the official docs can't find anything about permission level... ...

How to run a html file from php?

I am trying to figure out how we can run a html file within a php script. ...

Tooltips in PDFs: are they possible?

Hi. I'm using the tcpdf PHP class for creating PDFs. Is there any solution to add tooltips to links? ...

memory_limit=80M. what is the maximum image size for imagecreateformjpeg() ?

i have a webhosting that gives maximum memory_limit of 80M (i.e. ini_set("memory_limit","80M");). I'm using photo upload that uses the function imagecreatefromjpeg(); When i upload large images it gives the error "Fatal error: Allowed memory size of 83886080 bytes exhausted" What maximum size (in bytes) for the image i can restrict to th...

interpreting php as plain text when using php function require

Hello I have main site to which i put code using require function, but when i add php functions into it, they appear as plain text. The php code is rather long so i won't paste it here. Could anyone help me with that? Thanks ok i am adding some code: require part with only one function: <?php $content=<<<EOF echo 'hello'; EOF; requ...

What is the best way to store this type of data?

I have a form that is being filled by customers, the form is very long and contains approximately 30-40 fields. One part of the form is particularly complex to store as it is a matrix of checkboxes that the user needs to select. Example: > Fir Item | A Checkbox | B Checkbox | C Checkbox > Sec Item | A Checkbox | B Checkbox | C Checkbo...

How to put array values in different columns of same row of csv

I am having an array having multiple elements and i want each element to be inserted in a column of the same row of a csv file using php. I am trying hard but can't find the solution can anyone help me please as soon as possible ...

PHP check string for html

$content gives the html code like: <p>text</p> <p><img ... /></p> <div class="video">...</div> or just <p>text</p> <p>more text</p> Also we have a variable: $video_match = false; We should turn $video_match to true, if <div class="video"> (exactly this code) exists in $content. Thanks. ...

Extract text from HTML

Hello i need to extract <strong class="nfpd">Actors</strong>: example world <br /> this example word using regular expression in php ..... ...

I'm confused about searching between dates in mysql

Here, I changed one of my table's column type to standard mysql date format. <form action="'.$self.'?action=search" method="post"> <ul> <li>Oda No:</li> <li><input type="text" name="ro"/></li> <li>Check in:</li> <li><input type="text" name="cn"/></li> <li>Check out...

How to detect if *.ico file is a valid icon in PHP

I would like to test if *.ico images are valid icons in PHP. I tried to use getimagesize function but it doesn't support ICO files. ...

Twitter Turning off Basic Auth - is OAuth overkill for some tasks?

According to Twitter docs, basic auth is being turned off this month. I can see the benefit of OAuth when your service accepts third party user twitter login/id's, but for a simple twitter bot that simply post to a single bot twitter account, does OAuth seem like overkill? In the case of the latter, what's the least resource-expendful...