I am using php codeigniter and i am trying to import my contacts from my gmail and yahoomail exactly like twitter... I dont know how to get started? Any suggestion?
i need in an php file three drop down boxes or multiple select boxes.
the entries from these boxes are in a mysql database.
the single problem is that the entries in the thrid box depend on the second, and the entries in the second depend on the first.
can someone help? know any examples?
Hello Guys,
We have been using PHP/MySQL for our web application which has been growing a lot, the database is around 4-5GB and one of the table is 2GB sometimes, hence slowing down whenever any queries to that table is called.
Should we just try to optimize, or are we using MySQL above its limit? Will switching our web app to .NET/MSSQL resolve the issues?
Thanks
I am building a system, mostly for consolidating learning but will be used in practice.
I will try and verbally explain the part of the E-R diagram I am focusing on:
Each cadet can have many uniformID's
Each Uniform ID is a new entry in table uniform, so cadets (table) may look like:
id | name | ... | uniformID
1 | Example | ... | 1,2,3
uniform table:
id | notes | cadet
1 | Need new blahh | 1
2 | Some stuff needed | 1
3 | Whatever you like | 1
On second thought, looks like I wont need that third column in the db.
I am trying to iterate through each id in uniformID, code:
<?php
$cadet = $_GET['id']; // set from URL
$query = mysql_query("SELECT `uniformID` FROM `cadets`
WHERE id = '$cadet' LIMIT 1")
or die(mysql_error()); // get uniform needed as string
// store it
while ($row = mysql_fetch_array($query)) {
$uniformArray = $row['uniformID'];
}
echo $uniformArray . " ";
$exploded = explode(",", $uniformArray); // convert into an array
// for each key in the array perform a new query
foreach ($exploded as $key => $value) {
$query(count($exploded));
$query[$key] = mysql_query("SELECT * FROM `uniform` WHERE `id` = '$value'");
}
?
As I say, this is mainly for consolidation purposes but I have come up with a error, sql is saying:
Fatal error: Function name must be a string in C:\wamp\www\intranet\uniform.php on line 82
line 82 is:
$query[$key] = mysql_query("SELECT * FROM `uniform` WHERE `id` = '$value'");
I wasn't sure it would work so I tried it and now i'm stuck!
EDIT:
Thanks to everyone who has contributed to this! This is now the working code:
foreach ($exploded as $key => $value) {
//$query(count($exploded));
$query = mysql_query("SELECT * FROM `uniform` WHERE `id` = '$value'");
while ($row = mysql_fetch_array($query)) {
echo "<tr>
<td>" . $row['id'] . "</td>
<td>" . $row['note'] . "</td>
</tr>";
}
}
Added the while and did the iteration by nesting it in the foreach
hi
I've tried a few php IDEs , but still searching for the FASTEST one
all Java based IDEs are too slow, I have 2 computers to work, my home pc which is too fast, and my laptop witch is good , but cant handle a heave software.
and I have to work on them both, so I'm looking for the best free ide which is fast
I'm not talking about text-editors , because I already have np++ and its great, but looking for extra features to help me save time..
any tips?
Iam a little bit confused by php function declare.
What exactly is an single tick, i thought 1 tick = one line of code?
But if i use:
function myfunc() {
print "Tick";
}
register_tick_function("myfunc");
declare(ticks=1) {
echo 'foo!bar';
}
The script prints :
"Tick" 2 Times??
I am currently building a site and all the books I have read on PHP so far are just on functionality and not much on security. Is there a book that deals specifically with making your code/site secure? I don't want to go public and the next day have all my code changed or my database erased by SQL injection.
thanks
I have to build an application using Maven for PHP that has multiple modules.
The scenario in which the maven seems to not work is this: I have a common module and a client module depending on the first one.
When doing "mvn site" on the client module which depends on the common module, the test fails to see the paths to the common module. Is there a flow in my build or this is just not possible?
I have a PHP web application on an intranet that can extract the IP and host name of the current user on that page, but I was wondering if there is a way to get/extract their Active Directory/Windows username as well. Is this possible?
I want to run this function but show the result in a table row
strlen($cat_row['sms']
This is what i came up with but it is not working:
echo "<tr><td bgcolor=#626E7A>".**strlen($cat_row['cars']**."</td></tr>";
How do you show result of a php function in a table row? i am trying to format the output some how.
please help
Hello,
We have a need to access a DB that only allows one connection at a time. This screams "singleton" to me. The catch of course is that the singleton connection will be exposed (either directly or indirectly) via a web-service (most probable a SOAP based web-service - located on a separate server from the calling app(s) ) - which means that there may be more than one app / instance attempting to connect to the singleton class.
In PHP, what is the best way to create a global singleton or a web-service singleton?
TIA
When creating a Singleton in PHP, I ensure that it cannot be instantiated by doing the following:
class Singleton {
private function __construct() {}
private function __clone() {}
public static function getInstance() {}
}
However, I realised that defining a class as 'abstract' means that it cannot be instantiated. So is there anything wrong with doing the following instead:
abstract class Singleton {
public static function getInstance() {}
}
The second scenario allows me to write fewer lines of code which would be nice. (Not that it actually makes much of a difference.)
Hey,
I'm working on some old(ish) software in PHP that maintains a $cache array to reduce the number of SQL queries. I was thinking of just putting memcached in its place and I'm wondering whether or not to get rid of the internal caching. Would there still be a worthwihle performance increase if I keep the internal caching, or would memcached suffice?
Hello Friends!
I want to develop a shopping cart in php. I also want to integreate online payment facility using paypal.
Which allows payment thrugh credit card and decbit card.
So Please tell me how to integreate paypal in my own shopping cart to achive secure transaction?
Thank You!
Money, Staff, Skill and preference to open source or commercial is neutral. Lets take the best of the best programmers (for arguments sake) and think about this:
What will perform better overall:
PHP & MySQL
or
ASP.Net & Microsoft SQL
(I don't want biased answers, just
looking for Performance, and Speed).
<?
if($id == 2) {
?>
html goes here
<?
}
else {
?>
if id is not 2 then something goes here
<?
}
?>
How can I write php+html in one file more beautiful without learning smarty?
Hi All,
Using Reflection in PHP I can dynamically create a object like so
$target = 'core_domain_Person';
$reflect = new ReflectionClass($target);
$obj = $reflect->newInstance();
I would like to replicate this same concept in JavaScript is there a way to do this out of the box? Or is there a way to replicate what Reflection is doing?
I am new to coding and would just like to know a bit more about frameworks. How does a framework help you code and what exactly is it? Such as Zend for php.
I have a string which contains only numbers. Now I want to remove all leading 0s from that string
For example:
input: 000000001230
output: 1230
input: 01000
output: 1000
Is there any function in PHP/Zend for this?
Thanks
I wrote a html scraper to scrape my various social identites, so I can make a real time 'biography' website.
However after using php curl_exec, I find that texts that I have quoted, end up being formatted in a weird character set.
ex: "I love dogs" gets formatted to ’I love dogs ’
"I hate cheese" gets formatted to “I hate cheese�
How do I either scrub these characters, or set curl not to format quotes like this.
Also, I have turned off magic_quotes.