PHP - Do Anybody Know How To Write Php Script For Connecting Perforce?
Hello Friends, Im trying to connect Perforce from Linux. I want to get(sync) file from perforce, then need to edit and submit it back to perforce.... Do you guys have any sample codings to do so?? Waiting for ur reply, Thanks Rekha Similar TutorialsSomething I have never done, but want to learn the best practice for doing so, is a listener script. Example: one of our websites is in bespoke PHP and has two links that shows if there are any noticeboard 'notifications' or any new 'messages'. Ideally I'd like to show 1, 2, 3... etc as a count of how many are remaining for Messages. So if a new one comes in while they are on a page, that number literally changes while they are on the page. I assume this is with Ajax, and not straight forward. I don't know any DOM code or Javascript. But would appreciate some help please. Simon Hello: I have this snippet of code that will write the current year onto a page if it's embedded on the page itself: Code: [Select] <?php echo date("Y") ?> Works fine. But, when I include it in an included file and pull it onto the page with a function, it does not work. Like this: MyNav.php Code: [Select] <?php function spFooter() { $spFooter = " <p> © <?php echo date(\"Y\") ?> </p> "; return $spFooter; } ?> MyPage.php Code: [Select] <?php include('include/myNav.php'); ?> <html> ... <?php echo spFooter(); ?> ... </html> What is the proper way to do this, and also what are the basic rules for properly nesting PHP scripts like this? Thanks for the help. So let's assume i'm making a script for searching cars by different criteria. Name of the car, color, and mileage. I used to do this by using LIKE and just adding AND for as many times as needed. But i've read that that is obsolete and is giving servers a hard time, so i went ahead and started making a new script that will use fulltext search. I've hit a dead end. Code: [Select] function search($table,$what,$string,$limit,$start,$country) { global $totrows; global $pages; $string = explode("*",$string); $what = explode("*",$what); $cname = trim($string[0]); $t = 0; $parameters = ""; while (isset($what[$t])){ if ($t>0) { $paramm .= ", "; } $paramm .= trim($what[$t]); if ($t>0) { $parama .= " "; } $parama .= trim($string[$t]); $t++; } $parameters .= " AND locationc = '".$country."'"; $sql = "SELECT *, MATCH(".$paramm.") AGAINST('".$parama."') AS score FROM main WHERE MATCH(".$paramm.") AGAINST('".$parama."') ORDER BY score DESC"; $result = mysql_query($sql) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { var_dump($row); } } How does this work: The user selects and enters his parameters> The script then joins them all into a single variable which is then sent to the function(the reason i do this i because the user might input only the name, so that way i can add more criteria and not need to change the script)> The script explodes those into arrays and then it processes them into a form for use with sql> I run the sql query and then return the results. What's the problem? There's two of them actually> The first one is that mysql returns an error "Can't find FULLTEXT index matching the column list" even though i did setup fulltext indexes. (phpmyadmin c/p) Code: [Select] name FULLTEXT No No name 0 YES color FULLTEXT No No color 0 YES mileage FULLTEXT No No mileage 0 YES The second problem is that the script is not selective and will not work as intended. For example, a car's name is 300, the users input's 300, and the script will return those rows that had mileage 300 or 300000 or whatever. How do i fix this, and is FULLTEXT the right way to go with multi criteria search? I have approximately 2,300 videos embedded on my site, and I am constantly adding more. The videos are hosted by YouTube. When a video is deleted from YouTube, it becomes unavailable on my site. Each video's ID is in my MySQL database. A video ID looks like this: ZFOuxAx-dkc I need a script that will do the following: select the IDs from my database check if the videos are still available on YouTube create a list of the videos that are unavailable. If possible, it would be great if the script could also tell me if any of the videos have been blocked in certain countries. The script has to be fully commented so that I can understand it. I want to run the script manually every few days. I don't want to have to change my database tables. I've been told that you can use YouTube's API or YouTube's oEmbed interface. I've also been told that, because there are so many videos, you will have to use cURL multi handles. If interested in this project, please PM me your price. This is an urgent project. I have placed ads elsewhere. Hi there, I'm working on a project already started, and using WAMP+WINDOWS7+SQL2008R2, At this point it's connecting to a MSSQL DATABSE LIKE THIS: $dns = "TempGes2"; $con = odbc_connect($dns, $user, $pwd); This works fine, but i can't find where is the TempGes2 configured, it isn't in the odbcad32.exe, Any ideas, i need to point this to another DATABASE, Thank you in advance I have the following code created, however when i run it it doesn't come back as saying connected successfully?
<?php $host = "localhost"; $my_user = "root"; $my_password = ""; $my_db = "notes_db" $con = mysqli_connect("localhost","my_user","my_password","my_db"); echo ("Connected Successfully"); ?> Can someone tell me why in the following code, in the 'try' section, this code works: (first line after 'try')
$conn = new PDO("mysql:host=$servername;dbname=$dbasename", $username, $password); even though I have not declared a variable named $dbname,
but if I change it to "$databasename", which I have declared, it doesn't work. I don't understand that.
<code>
<?php So I'm currently watching this tutorial : http://youtu.be/9E0s4gsUeU0 And am trying to build the sample application shown there. However I do seem to run into some problems, so if someone could take the time to help me out; I would be very grateful! --- The application is a simple HTML form, which takes the data input and stores it into a MySQL database table. My project is organized as this : The actual form is stored on the insert.php file. Code: [Select] <?php include_once('resources/init.php'); if (isset($_POST['title'], $_POST['post'])) { // functions go here! } ?> <html> <head> <title> Post something! </title> </head> <body> <div id="form"> <form method="POST" action= " "> <label for="title">Title:</label><br> <input type="text" name="title" id="title" /><br> <label for="post">Post:</label><br> <textarea name="post" id="post" rows="15" cols="50"></textarea><br> </form> </div> </body> </html> The config.php and init.php are the configuration and initialize files. config.php Code: [Select] <?php $config['DB_HOST'] = 'localhost'; $config['DB_USER'] = 'root'; $config['DB_PASS'] = ''; $config['DB_NAME'] = 'form'; //foreach ( $config as $k => $v ) { // define(strtouper($k), $v); //} ?> init.php Code: [Select] <?php include_once('config.php'); mysql_connect(DB_HOST, DB_USER, DB_PASS); mysql_select_db(DB_NAME); ?> --- When I try this in my browser I get the error : Code: [Select] Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'DB_HOST' (11004) in C:\xampp\htdocs\form\resources\init.php on line 5 Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\xampp\htdocs\form\resources\init.php on line 6 Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in C:\xampp\htdocs\form\resources\init.php on line 6 Could someone tell me what is wrong? Thanks in advance! Windows 2012 R2 Web Farm IIs 8.5 PHP 7.2
I am trying to create a logon page using PHP create a database on my SQL 2014 server. Installed the PHP SQL Server Drivers for PHP 7.2
<?php
// Connect to MSSQL
if (!$link) { I get an HTTP 500 internal server error cant get past this one Any thing else I can provide to help us fix this let me know
Thank you
Tom Hey all
I'm working on a script which needs to connect to the Google Calendar API, but when I run the code I get
Fatal error: Uncaught exception 'Google_Auth_Exception' with message 'Error refreshing the OAuth2 token, message: '{ "error" : "invalid_grant" }'' in /home/public_html/cal_test/google-api-php/src/Google/Auth/OAuth2.php:341 Stack trace: #0 /home/public_html/cal_test/google-api-php/src/Google/Auth/OAuth2.php(300): Google_Auth_OAuth2->refreshTokenRequest(Array) #1 /home/public_html/cal_test/google-api-php/src/Google/Auth/OAuth2.php(230): Google_Auth_OAuth2->refreshTokenWithAssertion() #2 /home/public_html/cal_test/google-api-php/src/Google/Service/Resource.php(171): Google_Auth_OAuth2->sign(Object(Google_Http_Request)) #3 /home/public_html/cal_test/google-api-php/src/Google/Service/Calendar.php(1133): Google_Service_Resource->call('list', Array, 'Google_Service_...') #4 /home/public_html/cal_test/index.php(34): Google_Service_Calendar_CalendarList_Resource->listCalendarList() #5 {main} thrown in /home/public_html/cal_test/google-api-php/src/Google/Auth/OAuth2.php on line 341The code i'm using is <?php error_reporting(-1); ini_set('display_errors', 'On'); require_once "google-api-php/src/Google/Client.php"; require_once "google-api-php/src/Google/Service/Calendar.php"; // Service Account info $client_id = 'CLIENT_ID'; $service_account_name = 'EMAIL'; $key_file_location = 'FILE_LOC'; // Calendar id $calName = 'CAL_ID'; $client = new Google_Client(); $client->setApplicationName("Calendar test"); $service = new Google_Service_Calendar($client); $key = file_get_contents($key_file_location); $cred = new Google_Auth_AssertionCredentials( $service_account_name, array('https://www.googleapis.com/auth/calendar.readonly'), $key ); $client->setAssertionCredentials($cred); $cals = $service->calendarList->listCalendarList(); //print_r($cals); //exit; $events = $service->events->listEvents($calName); foreach ($events->getItems() as $event) { echo $event->getSummary(); } ?>i've spent serveral hours trying to locate a fix on Google, but so far i'm stuggling Can anyone help me? Thanks Edited by dweb, 09 October 2014 - 06:58 AM. Hi, my school say not to use XAMPP, and I already have PHP installed, MySQL installed, Apache I am not sure, but assuming if I have it installed, how do I connect to localhost b/c beforer when I use XAMPP, the default for where to get php/mysql running was: C:\xampp\htdocs\ Please any help appreciated! Hi all.
My database just stopped connecting? I have tried everything i could but no way! What could have happened and what can i do? I even went as far as creating the database connection inside the page to see if it will work but still no way!
Thanks How we can make the connection to ODBC in PHP If any shares the coding part then it would be great. (Table to database) If the script is not uploaded onto the server you cant use $dbc = mysql_connect('localhost', 'username', 'pass'); so how could I connect in cli? this did not work $dbc = mysql_connect('http://123.456.789.10', 'username', 'pass'); So what can I do? Thanks when I try to connect to my database with CLI I get this error Code: [Select] Access denied for user 'bommobco_cwbtest'@'cpe-123.45.789.123.neo.res.rr.com' (using password: YES) 123.45.789.123 being my ip address, how can I fix this issue so I can connect? hello,
uhm, im trying to make a log-in page that will connect to the areas wifi. i can make a log-in page using php and mysql but i was wondering how to make so that when the user "logs in" he/she will be connected to a certain areas wifi.
for example, our school has a wifi hot spot in which, when you try to connect to it your'e sent to a log-in page to determine whether your'e a student (or facilitator). if you are, once you log - in your'e sent to google page and then you can use the schools wifi. if you aren't then you can't connect to it.
so now my question is how to i make a log-in page that will allow a user to connect to wifi? do i have to contact the company (the one that manages web servers like pldt) for permission? are there any policies regarding this? can it be coded using php and others?
if you can tell me then please do. thank you in advance
Im trying to connect to a database from php. Heres the code: <?php $dbc = mysqli_connect('192.168.0.122', 'boyyo', 'KiaNNa11', 'aliendatabase') or die('Error connecting to MySQL server.'); $query = "INSERT INTO aliens_abduction (first_name, last_name, " . "when_it_happened, how_long, how_many, alien_description, " . "what_they_did, fang_spotted, other, email) " . "VALUES ('Sally', 'Jones', '3 days ago', '1 day', 'four', " . "green with six tentacles', 'We just talked and played with a dog', " . "'yes', 'I may have seen your dog. Contact me.', " . "'sally@gregs-list.net')"; $result = mysqli_query($dbc, $query) or die('Error querying database.'); ?> I think i have a theory that my MySQL server location is wrong but i dont know. I use HostGator to do this and im using Phpmyadmin. But everytime i type in a form that i created it says Error querying database. Can someone tell me whats wrong with this code. Oh by the way im using head first into PHP and MySQL Dear All, I am having 2 different DB on 2 different hosts. I am running MySQL Server on my local PC where the user is entering data in the tables. I have a website which has the identical DB on the web. I am able to connect to the database by using the codes on the server. I want to update the server DB with the local system DB by running one update command. I get the error "-SELECT command denied to user 'localusername'@'localhost' for table 'pst_data'" Given below is the code used for the process : //connecting the remote system DB $link = mysql_connect('IPAddress:3306', 'remoteusername', 'Password'); if (!$link) { die('Not connected : ' . mysql_error()); } $db_selected = mysql_select_db('remotedb', $link); if (!$db_selected) { die ('Can\'t use Remote System DB: ' . mysql_error()); } //connecting the local database on the webstite $weblink = mysql_connect("localhost","localusername","password"); if (!$weblink) { die('Not connected : ' . mysql_error()); } $webdb_selected = mysql_select_db('localwebdb', $weblink); if (!$webdb_selected) { die ('Can\'t use WebServer Database : ' . mysql_error()); } //query to fetch the records from remote ystem and insert into local website database $upd_Query=mysql_query("INSERT INTO localwebdb.`table` SELECT * FROM remotedb.`table` where field=' some condition' "); --------------------------------------------------- I have tested that I have connected the remote DB by running queries on the webserver. Could anyone bail me out so that i can copy the DB from remote to local Any help would be appreciated Hello again guys! What if i have 2 databases, db1 and db2. i want to read raw data from db1 and match it's content with data from db2, then produce some information. How can i do it at the same time? I know that to be able to access mysql data, we have to use the mysql_connect() and mysql_select_db(). mysql_select_db() only allows to connect to single database. what should i do? thanks for your help in advance. Hi! I need to retrieve data from a WCF Web Service and don't seem to be connecting when the "new SoapClient" is called. I am using php version 5.2. The service requires 2 Parmameters, an account ID and a comma separated email list. Can someone please tell me what I am doing wrong? Thanks! Code: [Select] <?php header('Content-Type: text/xml'); $client = new SoapClient('http://www.zbestlistings.com/WCF/Primedia.svc?wsdl'); $response = $client->GetPropertyXML(array( "AccountID" => "12807175152", "eMailList" => "Sheryl@Rentingslc.com, Tenants@Rpmwestvalley.com, Tom@Rpmsouthernutah.com" )); echo $response; ?> |