428 Posted Topics

Member Avatar for kkjay

[CODE] $query_birthdate = "SELECT day(user_birthday) as Day FROM users WHERE username='kkjay'"; $birthdate = mysql_query($query_birthdate, $connections) or die(mysql_error()); $row_birthdate = mysql_fetch_assoc($birthdate) echo $row_birthdate['Day']; [/CODE] Always use the mysql functions in your queries when you can, as you have done, the database server has that functionality for a reason. No reason to …

Member Avatar for kkjay
0
114
Member Avatar for epicrevolt

In my opinion the best way to do this would be to name your fields using an array index. [CODE] <input name="field[]" type="text" size="20" maxlength="40" /> <input name="field[]" type="text" size="20" maxlength="40" /> <input name="field[]" type="text" size="20" maxlength="40" /> [/CODE] Then when you process the fields with PHP it is as …

Member Avatar for epicrevolt
0
151
Member Avatar for tAALz

You would need to use runas on windows to run notepad.exe as the specified user: [CODE] <?php exec('runas /user:ComputerName\UserName "notepad"'); [/CODE] However, if the user account requires a password it will prompt and can not be completed via the command line directly. You could create a vb script or something …

Member Avatar for mschroeder
0
3K
Member Avatar for KSS

I have to agree with richieking here. There are numerous open source e-commerce packages that will probably offer more than you will possibly need. Pick one, learn it, install modules/plugins/etc and/or customize it where necessary. If you are just learning php and starting out with web development, this is not …

Member Avatar for jkon
0
125
Member Avatar for professor123

It doesn't look like you posted your entire table structures, hence there is no reasonable way to know where Exam_category.categoryid joins to the three other tables. I'd also like to know the conditions of your joins. e.g. Can a user take the same exam more than once. ( Fail, Fail, …

Member Avatar for mschroeder
0
112
Member Avatar for Shankye

Performance wise, you should avoid loading an entire file into memory when possible. The following code relies on the SPL (standard php library) which is mostly > php 5.1 Although this can also be done using the file functions in php. [CODE] <?php $email = 'user@domain.com'; $file = new SplFileObject('filename.txt'); …

Member Avatar for Shankye
0
164
Member Avatar for tcollins412
Re: Help

How about you post some code so we can see what you're talking about...

Member Avatar for diafol
0
106
Member Avatar for SuPrAiCeR69

Really two ways to do commonly do this. First, using a socket [CODE] <?php $fp = fsockopen("www.daniweb.com", 80, $errno, $errstr, 5); if (!$fp) { echo "$errstr ($errno)<br />\n"; } else { $out = "HEAD / HTTP/1.1\r\n"; $out .= "Host: www.daniweb.com\r\n"; $out .= "Connection: Close\r\n\r\n"; fwrite($fp, $out); while (!feof($fp)) { echo …

Member Avatar for mschroeder
0
2K
Member Avatar for leprakhauns

You can use xdebug to profile the code: [url]http://www.xdebug.org/docs/profiler[/url]

Member Avatar for mschroeder
0
181
Member Avatar for imti321

The php parser almost always points you right to the problem. In this case it has directed you to line 7. I took a quick glimpse and immediately realized the left parenthesis was typo'd with a left curly brace: [ICODE] $connect = mysql_connect {"localhost","root","webdesigning1") or die ("couldnt connect to mysql …

Member Avatar for Sanket_s
0
158
Member Avatar for Lolalola

There is absolutely no need to create your class files with a .class.php extension, or any special naming convention. However, many of the larger projects these days have moved to the PEAR standard for naming classes ([url]http://pear.php.net/manual/en/standards.naming.php[/url]). This is completely optional of course. I don't quite understand your question fully …

Member Avatar for mschroeder
0
153
Member Avatar for cossay

Honestly, the state of php6 is so widely unknown at this point, and with adoption of php 5.3 only starting to become common, your best bet would be to lose the 6.0.0-dev build, and develop on 5.3 if you want bleeding edge and any chance of actually having something deployed. …

Member Avatar for mschroeder
0
95
Member Avatar for noliasoulja
Member Avatar for ofir0803

If your input is always going to be HTML/XML this would be ridiculously easy using SimpleXML and an xpath query: [CODE] <?php $string = <<<XML <body> <img src="page.jpg" border="0" usemap="#fghf" /> <map name="fghf" id="fghf"> <area shape="rect" coords="10,71,258,236" href="#" alt="some_alt" title="some_title" /> <area shape="rect" coords="258,72,506,237" href="#" alt="some_alt" title="some_title" /> <area shape="rect" …

Member Avatar for ofir0803
0
190
Member Avatar for quibbie

The nuke codes man! We need the launch codes. Anything that relates to your pagination would be of interest. The code where it is implemented, and also the code that actually generates the pagination.

Member Avatar for diafol
0
165
Member Avatar for prettyrein

[CODE] function showDepartment() { require_once('lib/model/classDepartment.php'); $dept = new department(); $departmentID = $dept->showAllDepartment(); if(isset($_POST['addDepartment'])) $this->addDepartment(); if(isset($_POST['updateDepartment'])) $this->updateDepartment(); if(isset($_POST['yesDeleteDepartment'])) $this->deleteDepartment(); if(isset($_POST['noDeleteDepartment'])) echo "<script language='javascript'>window.location='department.php';</script>"; require_once('lib/view/tpl.department.php'); } [/CODE] Without knowing how the department class is setup, this is my best assumption.

Member Avatar for prettyrein
0
185
Member Avatar for arctushar

file_get_contents does exactly what the function name says. It opens a file reads all of the content from the file and stores it into a variable etc for your later use. If you want to use an additional php file within your index.php you want to use include/require ([url]http://php.net/manual/en/function.include.php[/url]) There …

Member Avatar for mschroeder
0
111
Member Avatar for rokape

[CODE] <?php //Start with the base string plus 15 decimal places $str = '1797693134862316'; //Add 293 0's to the string e.g. (308 - 15) for( $i=0; $i<293; $i++ ){ $str = $str . '0'; } //Use bcmath to divide it by 1048576 var_dump( bcdiv( $str, '1048576', 2 ) ); [/CODE] …

Member Avatar for rokape
0
2K
Member Avatar for jogieglenmait

The following code uses the SplFileObject [[url]http://www.php.net/manual/en/class.splfileobject.php][/url] from the SPL library. This ensures we never read the entire file into memory, only one line at a time. For small files it is okay to read it into an array, but it is best to get in the habit of working …

Member Avatar for jogieglenmait
0
153
Member Avatar for Stefano Mtangoo

Just a general observation, feel free to ignore the following. In your table you're using a surrogate primary key, the auto-incrementing column. When you clearly have a natural and practical composite primary key in (book, chapter, verse) as they are always provided and the combination of three digits may not …

Member Avatar for Stefano Mtangoo
0
369
Member Avatar for amit_kuetcse2k5

You need to install the ImageMagick binary library for windows. You can access this via the command line which is what a lot of legacy applications do. If you want to use the imagick extension then you need the appropriate dll file. Look at your phpinfo: [CODE] <?php phpinfo(); [/CODE] …

Member Avatar for mschroeder
0
62
Member Avatar for super_alex

[url]http://www.php.net/manual/en/language.operators.comparison.php[/url] Manual page breaks down just about anything you could possibly want to know.

Member Avatar for rizvihaider72
0
115
Member Avatar for Xtremefaith

What you're asking is more of a MySQL (I'm assuming) question than directly related to php. MySQL has a ton of date handling capabilities. Is the date column, which is [B]not[/B] a reserved keyword ([url]http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html[/url]), setup to be a Datetime, Date, Timestamp or Integer (unix timestamp) field?

Member Avatar for Xtremefaith
0
161
Member Avatar for Joe34

Your use of quotes is incorrect. In php anything wrapped in quotes is a string. If you put a number in quotes single or double it is considered a string. If you specifically want something to be a number, do not wrap it in quotes. [CODE] <?php $a = 5; …

Member Avatar for mschroeder
0
129
Member Avatar for ujjval dave

Using php 5.2.2+ this is a piece of cake. [CODE] <?php $date1 = new DateTime('2010-12-07'); $date2 = new DateTime('2010-12-07'); if( $date1 == $date2 ){ echo 'Dates are equal.'; } [/CODE] [url]http://www.php.net/manual/en/datetime.diff.php[/url] scroll down to example #2 for some examples.

Member Avatar for ujjval dave
0
9K
Member Avatar for zlloyd1

[CODE] <html> <form action="get.php" method="GET"> <input type="text" name="myname"><br> <input type="submit" value="click here"> </form> </html> <?php $name = $_GET["myname"]; echo "Hello, $name"; ?> [/CODE] 'myname' is not an index in the $_GET array prior to the form being submitted. [CODE] <html> <form action="get.php" method="GET"> <input type="text" name="myname"><br> <input type="submit" value="click here"> …

Member Avatar for diafol
0
247
Member Avatar for nika201

What version of PHP are you running, is it VC6 or VC9 compiled and is it Thread Safe (TS) or Not Thread Safe (NTS)? You can find this information by displaying phpinfo() and looking for the lines Zend Extension Build & PHP Extension Build

Member Avatar for nika201
0
144
Member Avatar for whiteyoh

I'm not sure if I completely follow what you're asking but array_count_values will return a count of all unique values in your array. Returning an array of unique array items and their count. First, you need to change [ICODE]$stateFrequency = array_count_values($values=1);[/ICODE] to [ICODE]$stateFrequency = array_count_values($values);[/ICODE] For your example array this …

Member Avatar for mschroeder
0
113
Member Avatar for Awah Mohamed

If you're going to build this to essentially sit on top of cPanel, there is an entire API for interacting with cPanel: [url]http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/XmlApi[/url] The easiest way to do this would be to have reseller access to cPanel and create the individual user accounts using sudomain.domain.com as their domain name. Set …

Member Avatar for Awah Mohamed
-2
145
Member Avatar for Awah Mohamed

I agree with everything ardav said. If you really desire to build a social engine from scratch, define your requirements. Then you will need to spend a lot of time with domain modeling and data storage design before you even start writing code. You could hack and patch it together …

Member Avatar for Awah Mohamed
0
200
Member Avatar for showman13

For a long time I was a fan of doing everything with unix timestamps, but there are, in most cases, limitations to these. One of the limitations would be the available range (Jan 1, 1970 - Jan 19, 2038). Its mostly a 32bit limitation and I would hope by 2038 …

Member Avatar for macobex
0
179
Member Avatar for sickpuppy18

If you're using php 5.3+ there are some new classes that make this easier to accomplish. [CODE] <?php //Define out start and end dates $start = new DateTime('2011-01-01'); $end = new DateTime('2011-02-01'); //Define our holidays //New Years Day //Martin Luther King Day $holidays = array( '2011-01-01', '2011-01-17', ); //Create a …

Member Avatar for sickpuppy18
0
2K
Member Avatar for balle

I know you already solved this, but you can also achieve this without having to do the addition in php. [CODE] mysql_query("UPDATE posts SET views = views + 1 WHERE id='$start'") or die(mysql_error()); [/CODE]

Member Avatar for mschroeder
0
84
Member Avatar for Awah Mohamed

Are you trying to join data from multiple tables in one database, or are you trying to join data across multiple tables in multiple databases?

Member Avatar for Awah Mohamed
0
96
Member Avatar for CEVGames

This to me sounds like something best handled by the database using a trigger. Questions (Table): [CODE] QuestionId int Question varchar Answer varchar DateActive datetime Value tinyint default 100 [/CODE] QuestionUserAnswers (Table): [CODE] QuestionId int UserId int Answer varchar Score tinyint (min 50, max 100) [/CODE] With your trigger being …

Member Avatar for CEVGames
0
289
Member Avatar for paradox814

Actually as of php 5.3 you are able to [URL="http://en.wikipedia.org/wiki/Monkey_patch"]monkey patch[/URL] core php code. Which is essentially replacing core functions at runtime. Illustrated by this blog: [url]http://till.klampaeckel.de/blog/archives/105-Monkey-patching-in-PHP.html[/url]

Member Avatar for NuMessiah
0
432
Member Avatar for vedro-compota

Can you please describe your use case a little more so we have a better idea of what you are trying to accomplish? You can read through a file line by line using fgets, but if you are trying to detect if a character is an end of line character, …

Member Avatar for vedro-compota
0
87
Member Avatar for debbier

I think this is going to depend more on how your array is actually structured. Post up and example of the array your iterating and a more detailed example of the result.

Member Avatar for debbier
0
167
Member Avatar for MoreBloodWine

In your code $get_numbers and $get_letters are variables. In the urls in the link you are building you are using the value of those variables in the url. So, [ICODE]<a href="index.php?page=21;l='.$get_letters.'"[/ICODE] would become [ICODE]<a href="index.php?page=21;l=1"[/ICODE] in your html. If the value of $get_letters was 1. This would mean the value …

Member Avatar for MoreBloodWine
0
145
Member Avatar for daneuchar

Wamp and PHP frameworks are not synonymous. Regardless whether you choose a to use a framework, you still need a web server installation, which is what Wamp is. As for frameworks, my suggestion is to make some quick applications under several of the big name frameworks and get a feel …

Member Avatar for daneuchar
0
132
Member Avatar for BaSk

BaSk, I have done just this. But, I use a command line tool called PDFTK ([url]http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/[/url]) Essentially, I take a fillable pdf that has been designed. Collect information from the user via a web interface and create xfdf from it ([url]http://partners.adobe.com/public/developer/en/xml/xfdf_2.0_draft.pdf[/url]). Once I have the generated xfdf I execute a …

Member Avatar for mschroeder
0
118
Member Avatar for veledrom

Then you probably want to look into using a 3rd party system for sending these bulk emails. There are lots of providers that supply this functionality, at a cost of course. [LIST] [*][URL="http://sendgrid.com/"]Send Grid[/URL] [*][URL="http://www.streamsend.com/"]StreamSend[/URL] [/LIST] Are two I am familiar with, StreamSend being one i've done a lot of …

Member Avatar for mschroeder
0
92
Member Avatar for Cool&Awesome

In my opinion there are several reasons to use thumbnails over full sized images. For starters the web is fast and your connection might be fast but there are still plenty of people who do not have fast connections. Second, since in a default state browsers only allow you to …

Member Avatar for Cool&Awesome
0
73
Member Avatar for Kniggles

[QUOTE][CODE]<?php <form action="ScoreCardAlpha.php" method="post"> A: <input type="text" name="$X" /> B: <input type="text" name="$Z" /> C: <input type="text" name="$W" /> // read input data on $W , $X or $Z has http// if so save after // if(!filter_has_var(INPUT_post, "$X")) { // if true **** deleate all char upto and including // …

Member Avatar for mschroeder
0
208
Member Avatar for Stefano Mtangoo

Assuming your table is a MyISAM and the particular column has a full-text index on it: [CODE] SELECT * FROM table WHERE MATCH (col1, col2, col3) AGAINST ('+Goa' IN BOOLEAN MODE); [/CODE] [url]http://dev.mysql.com/doc/refman/5.1/en/fulltext-boolean.html[/url] ***Apparently this does not REQUIRE a fulltext index, but will take a major performance hit

Member Avatar for Stefano Mtangoo
0
92
Member Avatar for feoperro

For simple projects IDE's aren't going to make your life any easier, but when you have thousands of files, classes, and functions in a project that you need to be able to easily and quickly reference an IDE makes worlds of difference in my opinion.

Member Avatar for feoperro
0
83
Member Avatar for P0lT10n

it is used in context with sprintf and printf etc? [url]http://php.net/manual/en/function.sprintf.php[/url]

Member Avatar for mschroeder
0
139
Member Avatar for tordolsen

There are several places the character set needs to be accounted for: [LIST=1] [*][URL="http://dev.mysql.com/doc/refman/5.0/en/charset-database.html"]Database Collation & Charset[/URL] [*][URL="http://dev.mysql.com/doc/refman/5.1/en/charset-table.html"]Table Collation & Charset[/URL] [*][URL="http://dev.mysql.com/doc/refman/5.0/en/charset-connection.html"]Charset of the database connection[/URL] [/LIST] From within php: [LIST] [*]MySQL Extension : [URL="http://www.php.net/manual/en/function.mysql-set-charset.php"]mysql_set_charset[/URL] [*]MySQLi Extension : [URL="http://www.php.net/manual/en/mysqli.set-charset.php"]mysqli->set_charset[/URL] [*][URL="http://www.galengrover.com/web-development/setting-the-connection-charset-with-php-mysql/"]PDO Extension[/URL] [/LIST] Also if you are displaying the content the …

Member Avatar for mschroeder
0
79
Member Avatar for benhowdle89
Member Avatar for monica singh
0
107
Member Avatar for rcavezza

You want to use the $storage->moveMessage( id, folder) method. This site illustrates it a little more in detail: [url]http://www.devcha.com/2010/06/how-to-removemove-messages-using-zend.html[/url] The comments at the bottom of the Zend_Mail documentation also elaborate on this: [url]http://framework.zend.com/manual/en/zend.mail.read.html[/url] Automatically routing an email from a user to a particular folder would require some kind of intermediate …

Member Avatar for rcavezza
0
322

The End.